<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-comment">{-
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998


Utilities for desugaring

This module exports some utility functions of no great interest.
-}</span><span>
</span><span id="line-10"></span><span>
</span><span id="line-11"></span><span class="hs-pragma">{-# LANGUAGE CPP #-}</span><span>
</span><span id="line-12"></span><span class="hs-pragma">{-# LANGUAGE FlexibleContexts #-}</span><span>
</span><span id="line-13"></span><span class="hs-pragma">{-# LANGUAGE LambdaCase #-}</span><span>
</span><span id="line-14"></span><span class="hs-pragma">{-# LANGUAGE TypeFamilies #-}</span><span>
</span><span id="line-15"></span><span class="hs-pragma">{-# LANGUAGE ViewPatterns #-}</span><span>
</span><span id="line-16"></span><span>
</span><span id="line-17"></span><span class="hs-comment">-- | Utility functions for constructing Core syntax, principally for desugaring</span><span>
</span><span id="line-18"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.HsToCore.Utils</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-19"></span><span>        </span><span class="annot"><a href="GHC.HsToCore.Monad.html#EquationInfo"><span class="hs-identifier">EquationInfo</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-20"></span><span>        </span><span class="annot"><a href="GHC.HsToCore.Utils.html#firstPat"><span class="hs-identifier">firstPat</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Utils.html#shiftEqns"><span class="hs-identifier">shiftEqns</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-21"></span><span>
</span><span id="line-22"></span><span>        </span><span class="annot"><a href="GHC.HsToCore.Monad.html#MatchResult"><span class="hs-identifier">MatchResult</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Utils.html#CaseAlt"><span class="hs-identifier">CaseAlt</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-23"></span><span>        </span><span class="annot"><a href="GHC.HsToCore.Utils.html#cantFailMatchResult"><span class="hs-identifier">cantFailMatchResult</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Utils.html#alwaysFailMatchResult"><span class="hs-identifier">alwaysFailMatchResult</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-24"></span><span>        </span><span class="annot"><a href="GHC.HsToCore.Utils.html#extractMatchResult"><span class="hs-identifier">extractMatchResult</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Utils.html#combineMatchResults"><span class="hs-identifier">combineMatchResults</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-25"></span><span>        </span><span class="annot"><a href="GHC.HsToCore.Utils.html#adjustMatchResultDs"><span class="hs-identifier">adjustMatchResultDs</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-26"></span><span>        </span><span class="annot"><a href="GHC.HsToCore.Utils.html#shareFailureHandler"><span class="hs-identifier">shareFailureHandler</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-27"></span><span>        </span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkCoLetMatchResult"><span class="hs-identifier">mkCoLetMatchResult</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkViewMatchResult"><span class="hs-identifier">mkViewMatchResult</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkGuardedMatchResult"><span class="hs-identifier">mkGuardedMatchResult</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-28"></span><span>        </span><span class="annot"><a href="GHC.HsToCore.Utils.html#matchCanFail"><span class="hs-identifier">matchCanFail</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkEvalMatchResult"><span class="hs-identifier">mkEvalMatchResult</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-29"></span><span>        </span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkCoPrimCaseMatchResult"><span class="hs-identifier">mkCoPrimCaseMatchResult</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkCoAlgCaseMatchResult"><span class="hs-identifier">mkCoAlgCaseMatchResult</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkCoSynCaseMatchResult"><span class="hs-identifier">mkCoSynCaseMatchResult</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-30"></span><span>        </span><span class="annot"><a href="GHC.HsToCore.Utils.html#wrapBind"><span class="hs-identifier">wrapBind</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Utils.html#wrapBinds"><span class="hs-identifier">wrapBinds</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-31"></span><span>
</span><span id="line-32"></span><span>        </span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkErrorAppDs"><span class="hs-identifier">mkErrorAppDs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkCoreAppDs"><span class="hs-identifier">mkCoreAppDs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkCoreAppsDs"><span class="hs-identifier">mkCoreAppsDs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkCastDs"><span class="hs-identifier">mkCastDs</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-33"></span><span>
</span><span id="line-34"></span><span>        </span><span class="annot"><a href="GHC.HsToCore.Utils.html#seqVar"><span class="hs-identifier">seqVar</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-35"></span><span>
</span><span id="line-36"></span><span>        </span><span class="hs-comment">-- LHs tuples</span><span>
</span><span id="line-37"></span><span>        </span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkLHsPatTup"><span class="hs-identifier">mkLHsPatTup</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkVanillaTuplePat"><span class="hs-identifier">mkVanillaTuplePat</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-38"></span><span>        </span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkBigLHsVarTupId"><span class="hs-identifier">mkBigLHsVarTupId</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkBigLHsTupId"><span class="hs-identifier">mkBigLHsTupId</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkBigLHsVarPatTupId"><span class="hs-identifier">mkBigLHsVarPatTupId</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkBigLHsPatTupId"><span class="hs-identifier">mkBigLHsPatTupId</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-39"></span><span>
</span><span id="line-40"></span><span>        </span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkSelectorBinds"><span class="hs-identifier">mkSelectorBinds</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-41"></span><span>
</span><span id="line-42"></span><span>        </span><span class="annot"><a href="GHC.HsToCore.Utils.html#selectSimpleMatchVarL"><span class="hs-identifier">selectSimpleMatchVarL</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Utils.html#selectMatchVars"><span class="hs-identifier">selectMatchVars</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Utils.html#selectMatchVar"><span class="hs-identifier">selectMatchVar</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-43"></span><span>        </span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkOptTickBox"><span class="hs-identifier">mkOptTickBox</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkBinaryTickBox"><span class="hs-identifier">mkBinaryTickBox</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Utils.html#decideBangHood"><span class="hs-identifier">decideBangHood</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-44"></span><span>        </span><span class="annot"><a href="GHC.HsToCore.Utils.html#isTrueLHsExpr"><span class="hs-identifier">isTrueLHsExpr</span></a></span><span>
</span><span id="line-45"></span><span>    </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span class="hs-cpp">

#include &quot;HsVersions.h&quot;
</span><span>
</span><span id="line-49"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-50"></span><span>
</span><span id="line-51"></span><span class="hs-keyword">import</span><span> </span><span class="hs-pragma">{-# SOURCE</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="annot"><a href="GHC.HsToCore.Match.html"><span class="hs-identifier">GHC.HsToCore.Match</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.HsToCore.Match.html#matchSimply"><span class="hs-identifier">matchSimply</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-52"></span><span class="hs-keyword">import</span><span> </span><span class="hs-pragma">{-# SOURCE</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="annot"><a href="GHC.HsToCore.Expr.html"><span class="hs-identifier">GHC.HsToCore.Expr</span></a></span><span>  </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.HsToCore.Expr.html#dsLExpr"><span class="hs-identifier">dsLExpr</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-53"></span><span>
</span><span id="line-54"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Hs.html"><span class="hs-identifier">GHC.Hs</span></a></span><span>
</span><span id="line-55"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.Zonk.html"><span class="hs-identifier">GHC.Tc.Utils.Zonk</span></a></span><span>
</span><span id="line-56"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html"><span class="hs-identifier">GHC.Tc.Utils.TcType</span></a></span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitTyConApp"><span class="hs-identifier">tcSplitTyConApp</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-57"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.html"><span class="hs-identifier">GHC.Core</span></a></span><span>
</span><span id="line-58"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html"><span class="hs-identifier">GHC.HsToCore.Monad</span></a></span><span>
</span><span id="line-59"></span><span>
</span><span id="line-60"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Utils.html"><span class="hs-identifier">GHC.Core.Utils</span></a></span><span>
</span><span id="line-61"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Make.html"><span class="hs-identifier">GHC.Core.Make</span></a></span><span>
</span><span id="line-62"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Id.Make.html"><span class="hs-identifier">GHC.Types.Id.Make</span></a></span><span>
</span><span id="line-63"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Id.html"><span class="hs-identifier">GHC.Types.Id</span></a></span><span>
</span><span id="line-64"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Literal.html"><span class="hs-identifier">GHC.Types.Literal</span></a></span><span>
</span><span id="line-65"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html"><span class="hs-identifier">GHC.Core.TyCon</span></a></span><span>
</span><span id="line-66"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html"><span class="hs-identifier">GHC.Core.DataCon</span></a></span><span>
</span><span id="line-67"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.PatSyn.html"><span class="hs-identifier">GHC.Core.PatSyn</span></a></span><span>
</span><span id="line-68"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Type.html"><span class="hs-identifier">GHC.Core.Type</span></a></span><span>
</span><span id="line-69"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.html"><span class="hs-identifier">GHC.Core.Coercion</span></a></span><span>
</span><span id="line-70"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Builtin.Types.Prim.html"><span class="hs-identifier">GHC.Builtin.Types.Prim</span></a></span><span>
</span><span id="line-71"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Builtin.Types.html"><span class="hs-identifier">GHC.Builtin.Types</span></a></span><span>
</span><span id="line-72"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html"><span class="hs-identifier">GHC.Types.Basic</span></a></span><span>
</span><span id="line-73"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.ConLike.html"><span class="hs-identifier">GHC.Core.ConLike</span></a></span><span>
</span><span id="line-74"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Unique.Set.html"><span class="hs-identifier">GHC.Types.Unique.Set</span></a></span><span>
</span><span id="line-75"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Unique.Supply.html"><span class="hs-identifier">GHC.Types.Unique.Supply</span></a></span><span>
</span><span id="line-76"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Unit.Module.html"><span class="hs-identifier">GHC.Unit.Module</span></a></span><span>
</span><span id="line-77"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Builtin.Names.html"><span class="hs-identifier">GHC.Builtin.Names</span></a></span><span>
</span><span id="line-78"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.html"><span class="hs-identifier">GHC.Types.Name</span></a></span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#isInternalName"><span class="hs-identifier">isInternalName</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-79"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span>
</span><span id="line-80"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html"><span class="hs-identifier">GHC.Types.SrcLoc</span></a></span><span>
</span><span id="line-81"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html"><span class="hs-identifier">GHC.Utils.Misc</span></a></span><span>
</span><span id="line-82"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html"><span class="hs-identifier">GHC.Driver.Session</span></a></span><span>
</span><span id="line-83"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.FastString.html"><span class="hs-identifier">GHC.Data.FastString</span></a></span><span>
</span><span id="line-84"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../ghc-boot/src/GHC.LanguageExtensions.html#"><span class="hs-identifier">GHC.LanguageExtensions</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">LangExt</span></span><span>
</span><span id="line-85"></span><span>
</span><span id="line-86"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Evidence.html"><span class="hs-identifier">GHC.Tc.Types.Evidence</span></a></span><span>
</span><span id="line-87"></span><span>
</span><span id="line-88"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#"><span class="hs-identifier">Control.Monad</span></a></span><span>    </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#zipWithM"><span class="hs-identifier">zipWithM</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-89"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.List.NonEmpty.html#"><span class="hs-identifier">Data.List.NonEmpty</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#NonEmpty"><span class="hs-identifier">NonEmpty</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-90"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Maybe.html#"><span class="hs-identifier">Data.Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Maybe.html#maybeToList"><span class="hs-identifier">maybeToList</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-91"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../base/src/Data.List.NonEmpty.html#"><span class="hs-identifier">Data.List.NonEmpty</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">NEL</span></span><span>
</span><span id="line-92"></span><span>
</span><span id="line-93"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
\subsection{ Selecting match variables}
*                                                                      *
************************************************************************

We're about to match against some patterns.  We want to make some
@Ids@ to use as match variables.  If a pattern has an @Id@ readily at
hand, which should indeed be bound to the pattern as a whole, then use it;
otherwise, make one up. The multiplicity argument is chosen as the multiplicity
of the variable if it is made up.
-}</span><span>
</span><span id="line-106"></span><span>
</span><span id="line-107"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#selectSimpleMatchVarL"><span class="hs-identifier hs-type">selectSimpleMatchVarL</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Mult"><span class="hs-identifier hs-type">Mult</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span>
</span><span id="line-108"></span><span class="hs-comment">-- Postcondition: the returned Id has an Internal Name</span><span>
</span><span id="line-109"></span><span id="selectSimpleMatchVarL"><span class="annot"><span class="annottext">selectSimpleMatchVarL :: Mult -&gt; XRec (GhcPass 'Typechecked) Pat -&gt; DsM Id
</span><a href="GHC.HsToCore.Utils.html#selectSimpleMatchVarL"><span class="hs-identifier hs-var hs-var">selectSimpleMatchVarL</span></a></span></span><span> </span><span id="local-6989586621681142904"><span class="annot"><span class="annottext">Mult
</span><a href="#local-6989586621681142904"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span id="local-6989586621681142903"><span class="annot"><span class="annottext">XRec (GhcPass 'Typechecked) Pat
</span><a href="#local-6989586621681142903"><span class="hs-identifier hs-var">pat</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Mult -&gt; Pat (GhcPass 'Typechecked) -&gt; DsM Id
</span><a href="GHC.HsToCore.Utils.html#selectMatchVar"><span class="hs-identifier hs-var">selectMatchVar</span></a></span><span> </span><span class="annot"><span class="annottext">Mult
</span><a href="#local-6989586621681142904"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenLocated SrcSpan (Pat (GhcPass 'Typechecked))
-&gt; Pat (GhcPass 'Typechecked)
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan (Pat (GhcPass 'Typechecked))
XRec (GhcPass 'Typechecked) Pat
</span><a href="#local-6989586621681142903"><span class="hs-identifier hs-var">pat</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-110"></span><span>
</span><span id="line-111"></span><span class="hs-comment">-- (selectMatchVars ps tys) chooses variables of type tys</span><span>
</span><span id="line-112"></span><span class="hs-comment">-- to use for matching ps against.  If the pattern is a variable,</span><span>
</span><span id="line-113"></span><span class="hs-comment">-- we try to use that, to save inventing lots of fresh variables.</span><span>
</span><span id="line-114"></span><span class="hs-comment">--</span><span>
</span><span id="line-115"></span><span class="hs-comment">-- OLD, but interesting note:</span><span>
</span><span id="line-116"></span><span class="hs-comment">--    But even if it is a variable, its type might not match.  Consider</span><span>
</span><span id="line-117"></span><span class="hs-comment">--      data T a where</span><span>
</span><span id="line-118"></span><span class="hs-comment">--        T1 :: Int -&gt; T Int</span><span>
</span><span id="line-119"></span><span class="hs-comment">--        T2 :: a   -&gt; T a</span><span>
</span><span id="line-120"></span><span class="hs-comment">--</span><span>
</span><span id="line-121"></span><span class="hs-comment">--      f :: T a -&gt; a -&gt; Int</span><span>
</span><span id="line-122"></span><span class="hs-comment">--      f (T1 i) (x::Int) = x</span><span>
</span><span id="line-123"></span><span class="hs-comment">--      f (T2 i) (y::a)   = 0</span><span>
</span><span id="line-124"></span><span class="hs-comment">--    Then we must not choose (x::Int) as the matching variable!</span><span>
</span><span id="line-125"></span><span class="hs-comment">-- And nowadays we won't, because the (x::Int) will be wrapped in a CoPat</span><span>
</span><span id="line-126"></span><span>
</span><span id="line-127"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#selectMatchVars"><span class="hs-identifier hs-type">selectMatchVars</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Mult"><span class="hs-identifier hs-type">Mult</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#Pat"><span class="hs-identifier hs-type">Pat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-128"></span><span class="hs-comment">-- Postcondition: the returned Ids have Internal Names</span><span>
</span><span id="line-129"></span><span id="selectMatchVars"><span class="annot"><span class="annottext">selectMatchVars :: [(Mult, Pat (GhcPass 'Typechecked))] -&gt; DsM [Id]
</span><a href="GHC.HsToCore.Utils.html#selectMatchVars"><span class="hs-identifier hs-var hs-var">selectMatchVars</span></a></span></span><span> </span><span id="local-6989586621681142901"><span class="annot"><span class="annottext">[(Mult, Pat (GhcPass 'Typechecked))]
</span><a href="#local-6989586621681142901"><span class="hs-identifier hs-var">ps</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((Mult, Pat (GhcPass 'Typechecked)) -&gt; DsM Id)
-&gt; [(Mult, Pat (GhcPass 'Typechecked))] -&gt; DsM [Id]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Mult -&gt; Pat (GhcPass 'Typechecked) -&gt; DsM Id)
-&gt; (Mult, Pat (GhcPass 'Typechecked)) -&gt; DsM Id
forall a b c. (a -&gt; b -&gt; c) -&gt; (a, b) -&gt; c
</span><a href="../../base/src/Data.Tuple.html#uncurry"><span class="hs-identifier hs-var">uncurry</span></a></span><span> </span><span class="annot"><span class="annottext">Mult -&gt; Pat (GhcPass 'Typechecked) -&gt; DsM Id
</span><a href="GHC.HsToCore.Utils.html#selectMatchVar"><span class="hs-identifier hs-var">selectMatchVar</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(Mult, Pat (GhcPass 'Typechecked))]
</span><a href="#local-6989586621681142901"><span class="hs-identifier hs-var">ps</span></a></span><span>
</span><span id="line-130"></span><span>
</span><span id="line-131"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#selectMatchVar"><span class="hs-identifier hs-type">selectMatchVar</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Mult"><span class="hs-identifier hs-type">Mult</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#Pat"><span class="hs-identifier hs-type">Pat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span>
</span><span id="line-132"></span><span class="hs-comment">-- Postcondition: the returned Id has an Internal Name</span><span>
</span><span id="line-133"></span><span id="selectMatchVar"><span class="annot"><span class="annottext">selectMatchVar :: Mult -&gt; Pat (GhcPass 'Typechecked) -&gt; DsM Id
</span><a href="GHC.HsToCore.Utils.html#selectMatchVar"><span class="hs-identifier hs-var hs-var">selectMatchVar</span></a></span></span><span> </span><span id="local-6989586621681142898"><span class="annot"><span class="annottext">Mult
</span><a href="#local-6989586621681142898"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#BangPat"><span class="hs-identifier hs-type">BangPat</span></a></span><span> </span><span class="annot"><span class="annottext">XBangPat (GhcPass 'Typechecked)
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681142896"><span class="annot"><span class="annottext">XRec (GhcPass 'Typechecked) Pat
</span><a href="#local-6989586621681142896"><span class="hs-identifier hs-var">pat</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Mult -&gt; Pat (GhcPass 'Typechecked) -&gt; DsM Id
</span><a href="GHC.HsToCore.Utils.html#selectMatchVar"><span class="hs-identifier hs-var">selectMatchVar</span></a></span><span> </span><span class="annot"><span class="annottext">Mult
</span><a href="#local-6989586621681142898"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenLocated SrcSpan (Pat (GhcPass 'Typechecked))
-&gt; Pat (GhcPass 'Typechecked)
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan (Pat (GhcPass 'Typechecked))
XRec (GhcPass 'Typechecked) Pat
</span><a href="#local-6989586621681142896"><span class="hs-identifier hs-var">pat</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-134"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#selectMatchVar"><span class="hs-identifier hs-var">selectMatchVar</span></a></span><span> </span><span id="local-6989586621681142895"><span class="annot"><span class="annottext">Mult
</span><a href="#local-6989586621681142895"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#LazyPat"><span class="hs-identifier hs-type">LazyPat</span></a></span><span> </span><span class="annot"><span class="annottext">XLazyPat (GhcPass 'Typechecked)
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681142893"><span class="annot"><span class="annottext">XRec (GhcPass 'Typechecked) Pat
</span><a href="#local-6989586621681142893"><span class="hs-identifier hs-var">pat</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Mult -&gt; Pat (GhcPass 'Typechecked) -&gt; DsM Id
</span><a href="GHC.HsToCore.Utils.html#selectMatchVar"><span class="hs-identifier hs-var">selectMatchVar</span></a></span><span> </span><span class="annot"><span class="annottext">Mult
</span><a href="#local-6989586621681142895"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenLocated SrcSpan (Pat (GhcPass 'Typechecked))
-&gt; Pat (GhcPass 'Typechecked)
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan (Pat (GhcPass 'Typechecked))
XRec (GhcPass 'Typechecked) Pat
</span><a href="#local-6989586621681142893"><span class="hs-identifier hs-var">pat</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-135"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#selectMatchVar"><span class="hs-identifier hs-var">selectMatchVar</span></a></span><span> </span><span id="local-6989586621681142892"><span class="annot"><span class="annottext">Mult
</span><a href="#local-6989586621681142892"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#ParPat"><span class="hs-identifier hs-type">ParPat</span></a></span><span> </span><span class="annot"><span class="annottext">XParPat (GhcPass 'Typechecked)
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681142890"><span class="annot"><span class="annottext">XRec (GhcPass 'Typechecked) Pat
</span><a href="#local-6989586621681142890"><span class="hs-identifier hs-var">pat</span></a></span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Mult -&gt; Pat (GhcPass 'Typechecked) -&gt; DsM Id
</span><a href="GHC.HsToCore.Utils.html#selectMatchVar"><span class="hs-identifier hs-var">selectMatchVar</span></a></span><span> </span><span class="annot"><span class="annottext">Mult
</span><a href="#local-6989586621681142892"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenLocated SrcSpan (Pat (GhcPass 'Typechecked))
-&gt; Pat (GhcPass 'Typechecked)
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan (Pat (GhcPass 'Typechecked))
XRec (GhcPass 'Typechecked) Pat
</span><a href="#local-6989586621681142890"><span class="hs-identifier hs-var">pat</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-136"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#selectMatchVar"><span class="hs-identifier hs-var">selectMatchVar</span></a></span><span> </span><span id="local-6989586621681142889"><span class="annot"><span class="annottext">Mult
</span><a href="#local-6989586621681142889"><span class="hs-identifier hs-var">_w</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#VarPat"><span class="hs-identifier hs-type">VarPat</span></a></span><span> </span><span class="annot"><span class="annottext">XVarPat (GhcPass 'Typechecked)
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681142887"><span class="annot"><span class="annottext">Located (IdP (GhcPass 'Typechecked))
</span><a href="#local-6989586621681142887"><span class="hs-identifier hs-var">var</span></a></span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; DsM Id
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; Id
</span><a href="GHC.Types.Id.html#localiseId"><span class="hs-identifier hs-var">localiseId</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenLocated SrcSpan Id -&gt; Id
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan Id
Located (IdP (GhcPass 'Typechecked))
</span><a href="#local-6989586621681142887"><span class="hs-identifier hs-var">var</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-137"></span><span>                                  </span><span class="hs-comment">-- Note [Localise pattern binders]</span><span>
</span><span id="line-138"></span><span>                                  </span><span class="hs-comment">--</span><span>
</span><span id="line-139"></span><span>                                  </span><span class="hs-comment">-- Remark: when the pattern is a variable (or</span><span>
</span><span id="line-140"></span><span>                                  </span><span class="hs-comment">-- an @-pattern), then w is the same as the</span><span>
</span><span id="line-141"></span><span>                                  </span><span class="hs-comment">-- multiplicity stored within the variable</span><span>
</span><span id="line-142"></span><span>                                  </span><span class="hs-comment">-- itself. It's easier to pull it from the</span><span>
</span><span id="line-143"></span><span>                                  </span><span class="hs-comment">-- variable, so we ignore the multiplicity.</span><span>
</span><span id="line-144"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#selectMatchVar"><span class="hs-identifier hs-var">selectMatchVar</span></a></span><span> </span><span id="local-6989586621681142885"><span class="annot"><span class="annottext">Mult
</span><a href="#local-6989586621681142885"><span class="hs-identifier hs-var">_w</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#AsPat"><span class="hs-identifier hs-type">AsPat</span></a></span><span> </span><span class="annot"><span class="annottext">XAsPat (GhcPass 'Typechecked)
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681142883"><span class="annot"><span class="annottext">Located (IdP (GhcPass 'Typechecked))
</span><a href="#local-6989586621681142883"><span class="hs-identifier hs-var">var</span></a></span></span><span> </span><span class="annot"><span class="annottext">XRec (GhcPass 'Typechecked) Pat
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">isManyDataConTy</span><span> </span><span class="hs-identifier">_w</span><span> </span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">return</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">unLoc</span><span> </span><span class="hs-identifier">var</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-145"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#selectMatchVar"><span class="hs-identifier hs-var">selectMatchVar</span></a></span><span> </span><span id="local-6989586621681142877"><span class="annot"><span class="annottext">Mult
</span><a href="#local-6989586621681142877"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span id="local-6989586621681142876"><span class="annot"><span class="annottext">Pat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681142876"><span class="hs-identifier hs-var">other_pat</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Mult -&gt; Mult -&gt; DsM Id
</span><a href="GHC.HsToCore.Monad.html#newSysLocalDsNoLP"><span class="hs-identifier hs-var">newSysLocalDsNoLP</span></a></span><span> </span><span class="annot"><span class="annottext">Mult
</span><a href="#local-6989586621681142877"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Pat (GhcPass 'Typechecked) -&gt; Mult
</span><a href="GHC.Tc.Utils.Zonk.html#hsPatType"><span class="hs-identifier hs-var">hsPatType</span></a></span><span> </span><span class="annot"><span class="annottext">Pat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681142876"><span class="hs-identifier hs-var">other_pat</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-146"></span><span>
</span><span id="line-147"></span><span class="hs-comment">{- Note [Localise pattern binders]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider     module M where
               [Just a] = e
After renaming it looks like
             module M where
               [Just M.a] = e

We don't generalise, since it's a pattern binding, monomorphic, etc,
so after desugaring we may get something like
             M.a = case e of (v:_) -&gt;
                   case v of Just M.a -&gt; M.a
Notice the &quot;M.a&quot; in the pattern; after all, it was in the original
pattern.  However, after optimisation those pattern binders can become
let-binders, and then end up floated to top level.  They have a
different *unique* by then (the simplifier is good about maintaining
proper scoping), but it's BAD to have two top-level bindings with the
External Name M.a, because that turns into two linker symbols for M.a.
It's quite rare for this to actually *happen* -- the only case I know
of is tc003 compiled with the 'hpc' way -- but that only makes it
all the more annoying.

To avoid this, we craftily call 'localiseId' in the desugarer, which
simply turns the External Name for the Id into an Internal one, but
doesn't change the unique.  So the desugarer produces this:
             M.a{r8} = case e of (v:_) -&gt;
                       case v of Just a{r8} -&gt; M.a{r8}
The unique is still 'r8', but the binding site in the pattern
is now an Internal Name.  Now the simplifier's usual mechanisms
will propagate that Name to all the occurrence sites, as well as
un-shadowing it, so we'll get
             M.a{r8} = case e of (v:_) -&gt;
                       case v of Just a{s77} -&gt; a{s77}
In fact, even GHC.Core.Subst.simplOptExpr will do this, and simpleOptExpr
runs on the output of the desugarer, so all is well by the end of
the desugaring pass.

See also Note [MatchIds] in GHC.HsToCore.Match

************************************************************************
*                                                                      *
* type synonym EquationInfo and access functions for its pieces        *
*                                                                      *
************************************************************************
\subsection[EquationInfo-synonym]{@EquationInfo@: a useful synonym}

The ``equation info'' used by @match@ is relatively complicated and
worthy of a type synonym and a few handy functions.
-}</span><span>
</span><span id="line-196"></span><span>
</span><span id="line-197"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#firstPat"><span class="hs-identifier hs-type">firstPat</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#EquationInfo"><span class="hs-identifier hs-type">EquationInfo</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#Pat"><span class="hs-identifier hs-type">Pat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span>
</span><span id="line-198"></span><span id="firstPat"><span class="annot"><span class="annottext">firstPat :: EquationInfo -&gt; Pat (GhcPass 'Typechecked)
</span><a href="GHC.HsToCore.Utils.html#firstPat"><span class="hs-identifier hs-var hs-var">firstPat</span></a></span></span><span> </span><span id="local-6989586621681142873"><span class="annot"><span class="annottext">EquationInfo
</span><a href="#local-6989586621681142873"><span class="hs-identifier hs-var">eqn</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">notNull</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">eqn_pats</span><span> </span><span class="hs-identifier">eqn</span><span class="hs-special">)</span><span> </span><span class="hs-special">)</span><span> </span><span class="hs-identifier">head</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">eqn_pats</span><span> </span><span class="hs-identifier">eqn</span><span class="hs-special">)</span><span>
</span><span id="line-199"></span><span>
</span><span id="line-200"></span><span id="local-6989586621681143221"><span class="annot"><a href="GHC.HsToCore.Utils.html#shiftEqns"><span class="hs-identifier hs-type">shiftEqns</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Functor"><span class="hs-identifier hs-type">Functor</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681143221"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621681143221"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#EquationInfo"><span class="hs-identifier hs-type">EquationInfo</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621681143221"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#EquationInfo"><span class="hs-identifier hs-type">EquationInfo</span></a></span></span><span>
</span><span id="line-201"></span><span class="hs-comment">-- Drop the first pattern in each equation</span><span>
</span><span id="line-202"></span><span id="shiftEqns"><span class="annot"><span class="annottext">shiftEqns :: forall (f :: * -&gt; *). Functor f =&gt; f EquationInfo -&gt; f EquationInfo
</span><a href="GHC.HsToCore.Utils.html#shiftEqns"><span class="hs-identifier hs-var hs-var">shiftEqns</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(EquationInfo -&gt; EquationInfo) -&gt; f EquationInfo -&gt; f EquationInfo
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">((EquationInfo -&gt; EquationInfo)
 -&gt; f EquationInfo -&gt; f EquationInfo)
-&gt; (EquationInfo -&gt; EquationInfo)
-&gt; f EquationInfo
-&gt; f EquationInfo
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681142867"><span class="annot"><span class="annottext">EquationInfo
</span><a href="#local-6989586621681142867"><span class="hs-identifier hs-var">eqn</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">EquationInfo
</span><a href="#local-6989586621681142867"><span class="hs-identifier hs-var">eqn</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">eqn_pats :: [Pat (GhcPass 'Typechecked)]
</span><a href="GHC.HsToCore.Monad.html#eqn_pats"><span class="hs-identifier hs-var">eqn_pats</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Pat (GhcPass 'Typechecked)] -&gt; [Pat (GhcPass 'Typechecked)]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#tail"><span class="hs-identifier hs-var">tail</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">EquationInfo -&gt; [Pat (GhcPass 'Typechecked)]
</span><a href="GHC.HsToCore.Monad.html#eqn_pats"><span class="hs-identifier hs-var hs-var">eqn_pats</span></a></span><span> </span><span class="annot"><span class="annottext">EquationInfo
</span><a href="#local-6989586621681142867"><span class="hs-identifier hs-var">eqn</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-203"></span><span>
</span><span id="line-204"></span><span class="hs-comment">-- Functions on MatchResult CoreExprs</span><span>
</span><span id="line-205"></span><span>
</span><span id="line-206"></span><span id="local-6989586621681143212"><span class="annot"><a href="GHC.HsToCore.Utils.html#matchCanFail"><span class="hs-identifier hs-type">matchCanFail</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#MatchResult"><span class="hs-identifier hs-type">MatchResult</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681143212"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span><span>
</span><span id="line-207"></span><span id="matchCanFail"><span class="annot"><span class="annottext">matchCanFail :: forall a. MatchResult a -&gt; Bool
</span><a href="GHC.HsToCore.Utils.html#matchCanFail"><span class="hs-identifier hs-var hs-var">matchCanFail</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.Monad.html#MR_Fallible"><span class="hs-identifier hs-type">MR_Fallible</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-208"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#matchCanFail"><span class="hs-identifier hs-var">matchCanFail</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.Monad.html#MR_Infallible"><span class="hs-identifier hs-type">MR_Infallible</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-209"></span><span>
</span><span id="line-210"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#alwaysFailMatchResult"><span class="hs-identifier hs-type">alwaysFailMatchResult</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#MatchResult"><span class="hs-identifier hs-type">MatchResult</span></a></span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span>
</span><span id="line-211"></span><span id="alwaysFailMatchResult"><span class="annot"><span class="annottext">alwaysFailMatchResult :: MatchResult CoreExpr
</span><a href="GHC.HsToCore.Utils.html#alwaysFailMatchResult"><span class="hs-identifier hs-var hs-var">alwaysFailMatchResult</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(CoreExpr -&gt; DsM CoreExpr) -&gt; MatchResult CoreExpr
forall a. (CoreExpr -&gt; DsM a) -&gt; MatchResult a
</span><a href="GHC.HsToCore.Monad.html#MR_Fallible"><span class="hs-identifier hs-var">MR_Fallible</span></a></span><span> </span><span class="annot"><span class="annottext">((CoreExpr -&gt; DsM CoreExpr) -&gt; MatchResult CoreExpr)
-&gt; (CoreExpr -&gt; DsM CoreExpr) -&gt; MatchResult CoreExpr
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681142863"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142863"><span class="hs-identifier hs-var">fail</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">CoreExpr -&gt; DsM CoreExpr
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142863"><span class="hs-identifier hs-var">fail</span></a></span><span>
</span><span id="line-212"></span><span>
</span><span id="line-213"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#cantFailMatchResult"><span class="hs-identifier hs-type">cantFailMatchResult</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#MatchResult"><span class="hs-identifier hs-type">MatchResult</span></a></span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span>
</span><span id="line-214"></span><span id="cantFailMatchResult"><span class="annot"><span class="annottext">cantFailMatchResult :: CoreExpr -&gt; MatchResult CoreExpr
</span><a href="GHC.HsToCore.Utils.html#cantFailMatchResult"><span class="hs-identifier hs-var hs-var">cantFailMatchResult</span></a></span></span><span> </span><span id="local-6989586621681142862"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142862"><span class="hs-identifier hs-var">expr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DsM CoreExpr -&gt; MatchResult CoreExpr
forall a. DsM a -&gt; MatchResult a
</span><a href="GHC.HsToCore.Monad.html#MR_Infallible"><span class="hs-identifier hs-var">MR_Infallible</span></a></span><span> </span><span class="annot"><span class="annottext">(DsM CoreExpr -&gt; MatchResult CoreExpr)
-&gt; DsM CoreExpr -&gt; MatchResult CoreExpr
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr -&gt; DsM CoreExpr
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142862"><span class="hs-identifier hs-var">expr</span></a></span><span>
</span><span id="line-215"></span><span>
</span><span id="line-216"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#extractMatchResult"><span class="hs-identifier hs-type">extractMatchResult</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#MatchResult"><span class="hs-identifier hs-type">MatchResult</span></a></span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span>
</span><span id="line-217"></span><span id="extractMatchResult"><span class="annot"><span class="annottext">extractMatchResult :: MatchResult CoreExpr -&gt; CoreExpr -&gt; DsM CoreExpr
</span><a href="GHC.HsToCore.Utils.html#extractMatchResult"><span class="hs-identifier hs-var hs-var">extractMatchResult</span></a></span></span><span> </span><span id="local-6989586621681142861"><span class="annot"><span class="annottext">MatchResult CoreExpr
</span><a href="#local-6989586621681142861"><span class="hs-identifier hs-var">match_result</span></a></span></span><span> </span><span id="local-6989586621681142860"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142860"><span class="hs-identifier hs-var">failure_expr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-218"></span><span>  </span><span class="annot"><span class="annottext">CoreExpr -&gt; MatchResult CoreExpr -&gt; DsM CoreExpr
forall a. CoreExpr -&gt; MatchResult a -&gt; DsM a
</span><a href="GHC.HsToCore.Monad.html#runMatchResult"><span class="hs-identifier hs-var">runMatchResult</span></a></span><span>
</span><span id="line-219"></span><span>    </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142860"><span class="hs-identifier hs-var">failure_expr</span></a></span><span>
</span><span id="line-220"></span><span>    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">MatchResult CoreExpr -&gt; MatchResult CoreExpr
</span><a href="GHC.HsToCore.Utils.html#shareFailureHandler"><span class="hs-identifier hs-var">shareFailureHandler</span></a></span><span> </span><span class="annot"><span class="annottext">MatchResult CoreExpr
</span><a href="#local-6989586621681142861"><span class="hs-identifier hs-var">match_result</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-221"></span><span>
</span><span id="line-222"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#combineMatchResults"><span class="hs-identifier hs-type">combineMatchResults</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#MatchResult"><span class="hs-identifier hs-type">MatchResult</span></a></span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#MatchResult"><span class="hs-identifier hs-type">MatchResult</span></a></span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#MatchResult"><span class="hs-identifier hs-type">MatchResult</span></a></span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span>
</span><span id="line-223"></span><span id="combineMatchResults"><span class="annot"><span class="annottext">combineMatchResults :: MatchResult CoreExpr
-&gt; MatchResult CoreExpr -&gt; MatchResult CoreExpr
</span><a href="GHC.HsToCore.Utils.html#combineMatchResults"><span class="hs-identifier hs-var hs-var">combineMatchResults</span></a></span></span><span> </span><span id="local-6989586621681142858"><span class="annot"><span class="annottext">match_result1 :: MatchResult CoreExpr
</span><a href="#local-6989586621681142858"><span class="hs-identifier hs-var">match_result1</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.Monad.html#MR_Infallible"><span class="hs-identifier hs-type">MR_Infallible</span></a></span><span> </span><span class="annot"><span class="annottext">DsM CoreExpr
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">MatchResult CoreExpr
</span><span class="hs-identifier">_</span></span><span>
</span><span id="line-224"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">MatchResult CoreExpr
</span><a href="#local-6989586621681142858"><span class="hs-identifier hs-var">match_result1</span></a></span><span>
</span><span id="line-225"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#combineMatchResults"><span class="hs-identifier hs-var">combineMatchResults</span></a></span><span> </span><span id="local-6989586621681142857"><span class="annot"><span class="annottext">MatchResult CoreExpr
</span><a href="#local-6989586621681142857"><span class="hs-identifier hs-var">match_result1</span></a></span></span><span> </span><span id="local-6989586621681142856"><span class="annot"><span class="annottext">MatchResult CoreExpr
</span><a href="#local-6989586621681142856"><span class="hs-identifier hs-var">match_result2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-226"></span><span>  </span><span class="hs-comment">-- if the first pattern needs a failure handler (i.e. if it is fallible),</span><span>
</span><span id="line-227"></span><span>  </span><span class="hs-comment">-- make it let-bind it bind it with `shareFailureHandler`.</span><span>
</span><span id="line-228"></span><span>  </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">MatchResult CoreExpr -&gt; MatchResult CoreExpr
</span><a href="GHC.HsToCore.Utils.html#shareFailureHandler"><span class="hs-identifier hs-var">shareFailureHandler</span></a></span><span> </span><span class="annot"><span class="annottext">MatchResult CoreExpr
</span><a href="#local-6989586621681142857"><span class="hs-identifier hs-var">match_result1</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-229"></span><span>    </span><span class="annot"><a href="GHC.HsToCore.Monad.html#MR_Infallible"><span class="hs-identifier hs-type">MR_Infallible</span></a></span><span> </span><span class="annot"><span class="annottext">DsM CoreExpr
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">MatchResult CoreExpr
</span><a href="#local-6989586621681142857"><span class="hs-identifier hs-var">match_result1</span></a></span><span>
</span><span id="line-230"></span><span>    </span><span class="annot"><a href="GHC.HsToCore.Monad.html#MR_Fallible"><span class="hs-identifier hs-type">MR_Fallible</span></a></span><span> </span><span id="local-6989586621681142855"><span class="annot"><span class="annottext">CoreExpr -&gt; DsM CoreExpr
</span><a href="#local-6989586621681142855"><span class="hs-identifier hs-var">body_fn1</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(CoreExpr -&gt; DsM CoreExpr) -&gt; MatchResult CoreExpr
forall a. (CoreExpr -&gt; DsM a) -&gt; MatchResult a
</span><a href="GHC.HsToCore.Monad.html#MR_Fallible"><span class="hs-identifier hs-var">MR_Fallible</span></a></span><span> </span><span class="annot"><span class="annottext">((CoreExpr -&gt; DsM CoreExpr) -&gt; MatchResult CoreExpr)
-&gt; (CoreExpr -&gt; DsM CoreExpr) -&gt; MatchResult CoreExpr
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681142854"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142854"><span class="hs-identifier hs-var">fail_expr</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-231"></span><span>      </span><span class="hs-comment">-- Before actually failing, try the next match arm.</span><span>
</span><span id="line-232"></span><span>      </span><span class="annot"><span class="annottext">CoreExpr -&gt; DsM CoreExpr
</span><a href="#local-6989586621681142855"><span class="hs-identifier hs-var">body_fn1</span></a></span><span> </span><span class="annot"><span class="annottext">(CoreExpr -&gt; DsM CoreExpr) -&gt; DsM CoreExpr -&gt; DsM CoreExpr
forall (m :: * -&gt; *) a b. Monad m =&gt; (a -&gt; m b) -&gt; m a -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3D%3C%3C"><span class="hs-operator hs-var">=&lt;&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr -&gt; MatchResult CoreExpr -&gt; DsM CoreExpr
forall a. CoreExpr -&gt; MatchResult a -&gt; DsM a
</span><a href="GHC.HsToCore.Monad.html#runMatchResult"><span class="hs-identifier hs-var">runMatchResult</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142854"><span class="hs-identifier hs-var">fail_expr</span></a></span><span> </span><span class="annot"><span class="annottext">MatchResult CoreExpr
</span><a href="#local-6989586621681142856"><span class="hs-identifier hs-var">match_result2</span></a></span><span>
</span><span id="line-233"></span><span>
</span><span id="line-234"></span><span id="local-6989586621681143203"><span id="local-6989586621681143204"><span class="annot"><a href="GHC.HsToCore.Utils.html#adjustMatchResultDs"><span class="hs-identifier hs-type">adjustMatchResultDs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621681143204"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681143203"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#MatchResult"><span class="hs-identifier hs-type">MatchResult</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681143204"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#MatchResult"><span class="hs-identifier hs-type">MatchResult</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681143203"><span class="hs-identifier hs-type">b</span></a></span></span></span><span>
</span><span id="line-235"></span><span id="adjustMatchResultDs"><span class="annot"><span class="annottext">adjustMatchResultDs :: forall a b. (a -&gt; DsM b) -&gt; MatchResult a -&gt; MatchResult b
</span><a href="GHC.HsToCore.Utils.html#adjustMatchResultDs"><span class="hs-identifier hs-var hs-var">adjustMatchResultDs</span></a></span></span><span> </span><span id="local-6989586621681142850"><span class="annot"><span class="annottext">a -&gt; DsM b
</span><a href="#local-6989586621681142850"><span class="hs-identifier hs-var">encl_fn</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-glyph">\</span><span class="hs-glyph">case</span><span>
</span><span id="line-236"></span><span>  </span><span class="annot"><a href="GHC.HsToCore.Monad.html#MR_Infallible"><span class="hs-identifier hs-type">MR_Infallible</span></a></span><span> </span><span id="local-6989586621681142849"><span class="annot"><span class="annottext">DsM a
</span><a href="#local-6989586621681142849"><span class="hs-identifier hs-var">body_fn</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">DsM b -&gt; MatchResult b
forall a. DsM a -&gt; MatchResult a
</span><a href="GHC.HsToCore.Monad.html#MR_Infallible"><span class="hs-identifier hs-var">MR_Infallible</span></a></span><span> </span><span class="annot"><span class="annottext">(DsM b -&gt; MatchResult b) -&gt; DsM b -&gt; MatchResult b
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-237"></span><span>    </span><span class="annot"><span class="annottext">a -&gt; DsM b
</span><a href="#local-6989586621681142850"><span class="hs-identifier hs-var">encl_fn</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; DsM b) -&gt; DsM a -&gt; DsM b
forall (m :: * -&gt; *) a b. Monad m =&gt; (a -&gt; m b) -&gt; m a -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3D%3C%3C"><span class="hs-operator hs-var">=&lt;&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">DsM a
</span><a href="#local-6989586621681142849"><span class="hs-identifier hs-var">body_fn</span></a></span><span>
</span><span id="line-238"></span><span>  </span><span class="annot"><a href="GHC.HsToCore.Monad.html#MR_Fallible"><span class="hs-identifier hs-type">MR_Fallible</span></a></span><span> </span><span id="local-6989586621681142848"><span class="annot"><span class="annottext">CoreExpr -&gt; DsM a
</span><a href="#local-6989586621681142848"><span class="hs-identifier hs-var">body_fn</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(CoreExpr -&gt; DsM b) -&gt; MatchResult b
forall a. (CoreExpr -&gt; DsM a) -&gt; MatchResult a
</span><a href="GHC.HsToCore.Monad.html#MR_Fallible"><span class="hs-identifier hs-var">MR_Fallible</span></a></span><span> </span><span class="annot"><span class="annottext">((CoreExpr -&gt; DsM b) -&gt; MatchResult b)
-&gt; (CoreExpr -&gt; DsM b) -&gt; MatchResult b
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681142847"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142847"><span class="hs-identifier hs-var">fail</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-239"></span><span>    </span><span class="annot"><span class="annottext">a -&gt; DsM b
</span><a href="#local-6989586621681142850"><span class="hs-identifier hs-var">encl_fn</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; DsM b) -&gt; DsM a -&gt; DsM b
forall (m :: * -&gt; *) a b. Monad m =&gt; (a -&gt; m b) -&gt; m a -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3D%3C%3C"><span class="hs-operator hs-var">=&lt;&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr -&gt; DsM a
</span><a href="#local-6989586621681142848"><span class="hs-identifier hs-var">body_fn</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142847"><span class="hs-identifier hs-var">fail</span></a></span><span>
</span><span id="line-240"></span><span>
</span><span id="line-241"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#wrapBinds"><span class="hs-identifier hs-type">wrapBinds</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span class="hs-special">,</span><span class="annot"><a href="GHC.Types.Var.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span>
</span><span id="line-242"></span><span id="wrapBinds"><span class="annot"><span class="annottext">wrapBinds :: [(Id, Id)] -&gt; CoreExpr -&gt; CoreExpr
</span><a href="GHC.HsToCore.Utils.html#wrapBinds"><span class="hs-identifier hs-var hs-var">wrapBinds</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span id="local-6989586621681142845"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142845"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142845"><span class="hs-identifier hs-var">e</span></a></span><span>
</span><span id="line-243"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#wrapBinds"><span class="hs-identifier hs-var">wrapBinds</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span id="local-6989586621681142844"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142844"><span class="hs-identifier hs-var">new</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621681142843"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142843"><span class="hs-identifier hs-var">old</span></a></span></span><span class="hs-special">)</span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621681142842"><span class="annot"><span class="annottext">[(Id, Id)]
</span><a href="#local-6989586621681142842"><span class="hs-identifier hs-var">prs</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681142841"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142841"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; Id -&gt; CoreExpr -&gt; CoreExpr
</span><a href="GHC.HsToCore.Utils.html#wrapBind"><span class="hs-identifier hs-var">wrapBind</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142844"><span class="hs-identifier hs-var">new</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142843"><span class="hs-identifier hs-var">old</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[(Id, Id)] -&gt; CoreExpr -&gt; CoreExpr
</span><a href="GHC.HsToCore.Utils.html#wrapBinds"><span class="hs-identifier hs-var">wrapBinds</span></a></span><span> </span><span class="annot"><span class="annottext">[(Id, Id)]
</span><a href="#local-6989586621681142842"><span class="hs-identifier hs-var">prs</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142841"><span class="hs-identifier hs-var">e</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-244"></span><span>
</span><span id="line-245"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#wrapBind"><span class="hs-identifier hs-type">wrapBind</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span>
</span><span id="line-246"></span><span id="wrapBind"><span class="annot"><span class="annottext">wrapBind :: Id -&gt; Id -&gt; CoreExpr -&gt; CoreExpr
</span><a href="GHC.HsToCore.Utils.html#wrapBind"><span class="hs-identifier hs-var hs-var">wrapBind</span></a></span></span><span> </span><span id="local-6989586621681142840"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142840"><span class="hs-identifier hs-var">new</span></a></span></span><span> </span><span id="local-6989586621681142839"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142839"><span class="hs-identifier hs-var">old</span></a></span></span><span> </span><span id="local-6989586621681142838"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142838"><span class="hs-identifier hs-var">body</span></a></span></span><span>   </span><span class="hs-comment">-- NB: this function must deal with term</span><span>
</span><span id="line-247"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142840"><span class="hs-identifier hs-var">new</span></a></span><span class="annot"><span class="annottext">Id -&gt; Id -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142839"><span class="hs-identifier hs-var">old</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142838"><span class="hs-identifier hs-var">body</span></a></span><span>  </span><span class="hs-comment">-- variables, type variables or coercion variables</span><span>
</span><span id="line-248"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bind Id -&gt; CoreExpr -&gt; CoreExpr
forall b. Bind b -&gt; Expr b -&gt; Expr b
</span><a href="GHC.Core.html#Let"><span class="hs-identifier hs-var">Let</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; CoreExpr -&gt; Bind Id
forall b. b -&gt; Expr b -&gt; Bind b
</span><a href="GHC.Core.html#NonRec"><span class="hs-identifier hs-var">NonRec</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142840"><span class="hs-identifier hs-var">new</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; CoreExpr
forall b. Id -&gt; Expr b
</span><a href="GHC.Core.html#varToCoreExpr"><span class="hs-identifier hs-var">varToCoreExpr</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142839"><span class="hs-identifier hs-var">old</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142838"><span class="hs-identifier hs-var">body</span></a></span><span>
</span><span id="line-249"></span><span>
</span><span id="line-250"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#seqVar"><span class="hs-identifier hs-type">seqVar</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span>
</span><span id="line-251"></span><span id="seqVar"><span class="annot"><span class="annottext">seqVar :: Id -&gt; CoreExpr -&gt; CoreExpr
</span><a href="GHC.HsToCore.Utils.html#seqVar"><span class="hs-identifier hs-var hs-var">seqVar</span></a></span></span><span> </span><span id="local-6989586621681142834"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142834"><span class="hs-identifier hs-var">var</span></a></span></span><span> </span><span id="local-6989586621681142833"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142833"><span class="hs-identifier hs-var">body</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoreExpr -&gt; Id -&gt; CoreExpr -&gt; CoreExpr
</span><a href="GHC.Core.Utils.html#mkDefaultCase"><span class="hs-identifier hs-var">mkDefaultCase</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; CoreExpr
forall b. Id -&gt; Expr b
</span><a href="GHC.Core.html#Var"><span class="hs-identifier hs-var">Var</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142834"><span class="hs-identifier hs-var">var</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142834"><span class="hs-identifier hs-var">var</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142833"><span class="hs-identifier hs-var">body</span></a></span><span>
</span><span id="line-252"></span><span>
</span><span id="line-253"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkCoLetMatchResult"><span class="hs-identifier hs-type">mkCoLetMatchResult</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreBind"><span class="hs-identifier hs-type">CoreBind</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#MatchResult"><span class="hs-identifier hs-type">MatchResult</span></a></span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#MatchResult"><span class="hs-identifier hs-type">MatchResult</span></a></span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span>
</span><span id="line-254"></span><span id="mkCoLetMatchResult"><span class="annot"><span class="annottext">mkCoLetMatchResult :: Bind Id -&gt; MatchResult CoreExpr -&gt; MatchResult CoreExpr
</span><a href="GHC.HsToCore.Utils.html#mkCoLetMatchResult"><span class="hs-identifier hs-var hs-var">mkCoLetMatchResult</span></a></span></span><span> </span><span id="local-6989586621681142829"><span class="annot"><span class="annottext">Bind Id
</span><a href="#local-6989586621681142829"><span class="hs-identifier hs-var">bind</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(CoreExpr -&gt; CoreExpr)
-&gt; MatchResult CoreExpr -&gt; MatchResult CoreExpr
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bind Id -&gt; CoreExpr -&gt; CoreExpr
</span><a href="GHC.Core.Make.html#mkCoreLet"><span class="hs-identifier hs-var">mkCoreLet</span></a></span><span> </span><span class="annot"><span class="annottext">Bind Id
</span><a href="#local-6989586621681142829"><span class="hs-identifier hs-var">bind</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-255"></span><span>
</span><span id="line-256"></span><span class="hs-comment">-- (mkViewMatchResult var' viewExpr mr) makes the expression</span><span>
</span><span id="line-257"></span><span class="hs-comment">-- let var' = viewExpr in mr</span><span>
</span><span id="line-258"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkViewMatchResult"><span class="hs-identifier hs-type">mkViewMatchResult</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#MatchResult"><span class="hs-identifier hs-type">MatchResult</span></a></span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#MatchResult"><span class="hs-identifier hs-type">MatchResult</span></a></span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span>
</span><span id="line-259"></span><span id="mkViewMatchResult"><span class="annot"><span class="annottext">mkViewMatchResult :: Id -&gt; CoreExpr -&gt; MatchResult CoreExpr -&gt; MatchResult CoreExpr
</span><a href="GHC.HsToCore.Utils.html#mkViewMatchResult"><span class="hs-identifier hs-var hs-var">mkViewMatchResult</span></a></span></span><span> </span><span id="local-6989586621681142827"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142827"><span class="hs-identifier hs-var">var'</span></a></span></span><span> </span><span id="local-6989586621681142826"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142826"><span class="hs-identifier hs-var">viewExpr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(CoreExpr -&gt; CoreExpr)
-&gt; MatchResult CoreExpr -&gt; MatchResult CoreExpr
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">((CoreExpr -&gt; CoreExpr)
 -&gt; MatchResult CoreExpr -&gt; MatchResult CoreExpr)
-&gt; (CoreExpr -&gt; CoreExpr)
-&gt; MatchResult CoreExpr
-&gt; MatchResult CoreExpr
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Bind Id -&gt; CoreExpr -&gt; CoreExpr
</span><a href="GHC.Core.Make.html#mkCoreLet"><span class="hs-identifier hs-var">mkCoreLet</span></a></span><span> </span><span class="annot"><span class="annottext">(Bind Id -&gt; CoreExpr -&gt; CoreExpr)
-&gt; Bind Id -&gt; CoreExpr -&gt; CoreExpr
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Id -&gt; CoreExpr -&gt; Bind Id
forall b. b -&gt; Expr b -&gt; Bind b
</span><a href="GHC.Core.html#NonRec"><span class="hs-identifier hs-var">NonRec</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142827"><span class="hs-identifier hs-var">var'</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142826"><span class="hs-identifier hs-var">viewExpr</span></a></span><span>
</span><span id="line-260"></span><span>
</span><span id="line-261"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkEvalMatchResult"><span class="hs-identifier hs-type">mkEvalMatchResult</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#MatchResult"><span class="hs-identifier hs-type">MatchResult</span></a></span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#MatchResult"><span class="hs-identifier hs-type">MatchResult</span></a></span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span>
</span><span id="line-262"></span><span id="mkEvalMatchResult"><span class="annot"><span class="annottext">mkEvalMatchResult :: Id -&gt; Mult -&gt; MatchResult CoreExpr -&gt; MatchResult CoreExpr
</span><a href="GHC.HsToCore.Utils.html#mkEvalMatchResult"><span class="hs-identifier hs-var hs-var">mkEvalMatchResult</span></a></span></span><span> </span><span id="local-6989586621681142824"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142824"><span class="hs-identifier hs-var">var</span></a></span></span><span> </span><span id="local-6989586621681142823"><span class="annot"><span class="annottext">Mult
</span><a href="#local-6989586621681142823"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(CoreExpr -&gt; CoreExpr)
-&gt; MatchResult CoreExpr -&gt; MatchResult CoreExpr
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">((CoreExpr -&gt; CoreExpr)
 -&gt; MatchResult CoreExpr -&gt; MatchResult CoreExpr)
-&gt; (CoreExpr -&gt; CoreExpr)
-&gt; MatchResult CoreExpr
-&gt; MatchResult CoreExpr
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681142822"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142822"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-263"></span><span>  </span><span class="annot"><span class="annottext">CoreExpr -&gt; Id -&gt; Mult -&gt; [Alt Id] -&gt; CoreExpr
forall b. Expr b -&gt; b -&gt; Mult -&gt; [Alt b] -&gt; Expr b
</span><a href="GHC.Core.html#Case"><span class="hs-identifier hs-var">Case</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; CoreExpr
forall b. Id -&gt; Expr b
</span><a href="GHC.Core.html#Var"><span class="hs-identifier hs-var">Var</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142824"><span class="hs-identifier hs-var">var</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142824"><span class="hs-identifier hs-var">var</span></a></span><span> </span><span class="annot"><span class="annottext">Mult
</span><a href="#local-6989586621681142823"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><span class="annottext">AltCon
</span><a href="GHC.Core.html#DEFAULT"><span class="hs-identifier hs-var">DEFAULT</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142822"><span class="hs-identifier hs-var">e</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-264"></span><span>
</span><span id="line-265"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkGuardedMatchResult"><span class="hs-identifier hs-type">mkGuardedMatchResult</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#MatchResult"><span class="hs-identifier hs-type">MatchResult</span></a></span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#MatchResult"><span class="hs-identifier hs-type">MatchResult</span></a></span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span>
</span><span id="line-266"></span><span id="mkGuardedMatchResult"><span class="annot"><span class="annottext">mkGuardedMatchResult :: CoreExpr -&gt; MatchResult CoreExpr -&gt; MatchResult CoreExpr
</span><a href="GHC.HsToCore.Utils.html#mkGuardedMatchResult"><span class="hs-identifier hs-var hs-var">mkGuardedMatchResult</span></a></span></span><span> </span><span id="local-6989586621681142819"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142819"><span class="hs-identifier hs-var">pred_expr</span></a></span></span><span> </span><span id="local-6989586621681142818"><span class="annot"><span class="annottext">MatchResult CoreExpr
</span><a href="#local-6989586621681142818"><span class="hs-identifier hs-var">mr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(CoreExpr -&gt; DsM CoreExpr) -&gt; MatchResult CoreExpr
forall a. (CoreExpr -&gt; DsM a) -&gt; MatchResult a
</span><a href="GHC.HsToCore.Monad.html#MR_Fallible"><span class="hs-identifier hs-var">MR_Fallible</span></a></span><span> </span><span class="annot"><span class="annottext">((CoreExpr -&gt; DsM CoreExpr) -&gt; MatchResult CoreExpr)
-&gt; (CoreExpr -&gt; DsM CoreExpr) -&gt; MatchResult CoreExpr
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681142817"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142817"><span class="hs-identifier hs-var">fail</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-267"></span><span>  </span><span id="local-6989586621681142816"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142816"><span class="hs-identifier hs-var">body</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CoreExpr -&gt; MatchResult CoreExpr -&gt; DsM CoreExpr
forall a. CoreExpr -&gt; MatchResult a -&gt; DsM a
</span><a href="GHC.HsToCore.Monad.html#runMatchResult"><span class="hs-identifier hs-var">runMatchResult</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142817"><span class="hs-identifier hs-var">fail</span></a></span><span> </span><span class="annot"><span class="annottext">MatchResult CoreExpr
</span><a href="#local-6989586621681142818"><span class="hs-identifier hs-var">mr</span></a></span><span>
</span><span id="line-268"></span><span>  </span><span class="annot"><span class="annottext">CoreExpr -&gt; DsM CoreExpr
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CoreExpr -&gt; CoreExpr -&gt; CoreExpr -&gt; CoreExpr
</span><a href="GHC.Core.Make.html#mkIfThenElse"><span class="hs-identifier hs-var">mkIfThenElse</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142819"><span class="hs-identifier hs-var">pred_expr</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142816"><span class="hs-identifier hs-var">body</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142817"><span class="hs-identifier hs-var">fail</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-269"></span><span>
</span><span id="line-270"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkCoPrimCaseMatchResult"><span class="hs-identifier hs-type">mkCoPrimCaseMatchResult</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span>                  </span><span class="hs-comment">-- Scrutinee</span><span>
</span><span id="line-271"></span><span>                        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span>                      </span><span class="hs-comment">-- Type of the case</span><span>
</span><span id="line-272"></span><span>                        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Literal.html#Literal"><span class="hs-identifier hs-type">Literal</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#MatchResult"><span class="hs-identifier hs-type">MatchResult</span></a></span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>  </span><span class="hs-comment">-- Alternatives</span><span>
</span><span id="line-273"></span><span>                        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#MatchResult"><span class="hs-identifier hs-type">MatchResult</span></a></span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span>               </span><span class="hs-comment">-- Literals are all unlifted</span><span>
</span><span id="line-274"></span><span id="mkCoPrimCaseMatchResult"><span class="annot"><span class="annottext">mkCoPrimCaseMatchResult :: Id
-&gt; Mult
-&gt; [(Literal, MatchResult CoreExpr)]
-&gt; MatchResult CoreExpr
</span><a href="GHC.HsToCore.Utils.html#mkCoPrimCaseMatchResult"><span class="hs-identifier hs-var hs-var">mkCoPrimCaseMatchResult</span></a></span></span><span> </span><span id="local-6989586621681142814"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142814"><span class="hs-identifier hs-var">var</span></a></span></span><span> </span><span id="local-6989586621681142813"><span class="annot"><span class="annottext">Mult
</span><a href="#local-6989586621681142813"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span id="local-6989586621681142812"><span class="annot"><span class="annottext">[(Literal, MatchResult CoreExpr)]
</span><a href="#local-6989586621681142812"><span class="hs-identifier hs-var">match_alts</span></a></span></span><span>
</span><span id="line-275"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(CoreExpr -&gt; DsM CoreExpr) -&gt; MatchResult CoreExpr
forall a. (CoreExpr -&gt; DsM a) -&gt; MatchResult a
</span><a href="GHC.HsToCore.Monad.html#MR_Fallible"><span class="hs-identifier hs-var">MR_Fallible</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr -&gt; DsM CoreExpr
</span><a href="#local-6989586621681142811"><span class="hs-identifier hs-var">mk_case</span></a></span><span>
</span><span id="line-276"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-277"></span><span>    </span><span id="local-6989586621681142811"><span class="annot"><span class="annottext">mk_case :: CoreExpr -&gt; DsM CoreExpr
</span><a href="#local-6989586621681142811"><span class="hs-identifier hs-var hs-var">mk_case</span></a></span></span><span> </span><span id="local-6989586621681142810"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142810"><span class="hs-identifier hs-var">fail</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-278"></span><span>        </span><span id="local-6989586621681142809"><span class="annot"><span class="annottext">[Alt Id]
</span><a href="#local-6989586621681142809"><span class="hs-identifier hs-var">alts</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">((Literal, MatchResult CoreExpr)
 -&gt; IOEnv (Env DsGblEnv DsLclEnv) (Alt Id))
-&gt; [(Literal, MatchResult CoreExpr)]
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [Alt Id]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CoreExpr
-&gt; (Literal, MatchResult CoreExpr)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) (Alt Id)
forall {c} {a}.
CoreExpr
-&gt; (Literal, MatchResult c)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) (AltCon, [a], c)
</span><a href="#local-6989586621681142808"><span class="hs-identifier hs-var">mk_alt</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142810"><span class="hs-identifier hs-var">fail</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(Literal, MatchResult CoreExpr)]
</span><a href="#local-6989586621681142807"><span class="hs-identifier hs-var">sorted_alts</span></a></span><span>
</span><span id="line-279"></span><span>        </span><span class="annot"><span class="annottext">CoreExpr -&gt; DsM CoreExpr
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CoreExpr -&gt; Id -&gt; Mult -&gt; [Alt Id] -&gt; CoreExpr
forall b. Expr b -&gt; b -&gt; Mult -&gt; [Alt b] -&gt; Expr b
</span><a href="GHC.Core.html#Case"><span class="hs-identifier hs-var">Case</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; CoreExpr
forall b. Id -&gt; Expr b
</span><a href="GHC.Core.html#Var"><span class="hs-identifier hs-var">Var</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142814"><span class="hs-identifier hs-var">var</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142814"><span class="hs-identifier hs-var">var</span></a></span><span> </span><span class="annot"><span class="annottext">Mult
</span><a href="#local-6989586621681142813"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">AltCon
</span><a href="GHC.Core.html#DEFAULT"><span class="hs-identifier hs-var">DEFAULT</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142810"><span class="hs-identifier hs-var">fail</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Alt Id -&gt; [Alt Id] -&gt; [Alt Id]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[Alt Id]
</span><a href="#local-6989586621681142809"><span class="hs-identifier hs-var">alts</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-280"></span><span>
</span><span id="line-281"></span><span>    </span><span id="local-6989586621681142807"><span class="annot"><span class="annottext">sorted_alts :: [(Literal, MatchResult CoreExpr)]
</span><a href="#local-6989586621681142807"><span class="hs-identifier hs-var hs-var">sorted_alts</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((Literal, MatchResult CoreExpr) -&gt; Literal)
-&gt; [(Literal, MatchResult CoreExpr)]
-&gt; [(Literal, MatchResult CoreExpr)]
forall b a. Ord b =&gt; (a -&gt; b) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Exts.html#sortWith"><span class="hs-identifier hs-var">sortWith</span></a></span><span> </span><span class="annot"><span class="annottext">(Literal, MatchResult CoreExpr) -&gt; Literal
forall a b. (a, b) -&gt; a
</span><a href="../../base/src/Data.Tuple.html#fst"><span class="hs-identifier hs-var">fst</span></a></span><span> </span><span class="annot"><span class="annottext">[(Literal, MatchResult CoreExpr)]
</span><a href="#local-6989586621681142812"><span class="hs-identifier hs-var">match_alts</span></a></span><span>       </span><span class="hs-comment">-- Right order for a Case</span><span>
</span><span id="line-282"></span><span>    </span><span id="local-6989586621681142808"><span class="annot"><span class="annottext">mk_alt :: CoreExpr
-&gt; (Literal, MatchResult c)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) (AltCon, [a], c)
</span><a href="#local-6989586621681142808"><span class="hs-identifier hs-var hs-var">mk_alt</span></a></span></span><span> </span><span id="local-6989586621681142803"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142803"><span class="hs-identifier hs-var">fail</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681142802"><span class="annot"><span class="annottext">Literal
</span><a href="#local-6989586621681142802"><span class="hs-identifier hs-var">lit</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681142801"><span class="annot"><span class="annottext">MatchResult c
</span><a href="#local-6989586621681142801"><span class="hs-identifier hs-var">mr</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-283"></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">not</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">litIsLifted</span><span> </span><span class="hs-identifier">lit</span><span class="hs-special">)</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-284"></span><span>         </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621681142799"><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621681142799"><span class="hs-identifier hs-var">body</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CoreExpr -&gt; MatchResult c -&gt; DsM c
forall a. CoreExpr -&gt; MatchResult a -&gt; DsM a
</span><a href="GHC.HsToCore.Monad.html#runMatchResult"><span class="hs-identifier hs-var">runMatchResult</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142803"><span class="hs-identifier hs-var">fail</span></a></span><span> </span><span class="annot"><span class="annottext">MatchResult c
</span><a href="#local-6989586621681142801"><span class="hs-identifier hs-var">mr</span></a></span><span>
</span><span id="line-285"></span><span>            </span><span class="annot"><span class="annottext">(AltCon, [a], c) -&gt; IOEnv (Env DsGblEnv DsLclEnv) (AltCon, [a], c)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Literal -&gt; AltCon
</span><a href="GHC.Core.html#LitAlt"><span class="hs-identifier hs-var">LitAlt</span></a></span><span> </span><span class="annot"><span class="annottext">Literal
</span><a href="#local-6989586621681142802"><span class="hs-identifier hs-var">lit</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621681142799"><span class="hs-identifier hs-var">body</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-286"></span><span>
</span><span id="line-287"></span><span class="hs-keyword">data</span><span> </span><span id="CaseAlt"><span class="annot"><a href="GHC.HsToCore.Utils.html#CaseAlt"><span class="hs-identifier hs-var">CaseAlt</span></a></span></span><span> </span><span id="local-6989586621681143185"><span class="annot"><a href="#local-6989586621681143185"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="MkCaseAlt"><span class="annot"><a href="GHC.HsToCore.Utils.html#MkCaseAlt"><span class="hs-identifier hs-var">MkCaseAlt</span></a></span></span><span class="hs-special">{</span><span> </span><span id="alt_pat"><span class="annot"><span class="annottext">forall a. CaseAlt a -&gt; a
</span><a href="GHC.HsToCore.Utils.html#alt_pat"><span class="hs-identifier hs-var hs-var">alt_pat</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621681143185"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-288"></span><span>                            </span><span id="alt_bndrs"><span class="annot"><span class="annottext">forall a. CaseAlt a -&gt; [Id]
</span><a href="GHC.HsToCore.Utils.html#alt_bndrs"><span class="hs-identifier hs-var hs-var">alt_bndrs</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span>
</span><span id="line-289"></span><span>                            </span><span id="alt_wrapper"><span class="annot"><span class="annottext">forall a. CaseAlt a -&gt; HsWrapper
</span><a href="GHC.HsToCore.Utils.html#alt_wrapper"><span class="hs-identifier hs-var hs-var">alt_wrapper</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Evidence.html#HsWrapper"><span class="hs-identifier hs-type">HsWrapper</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-290"></span><span>                            </span><span id="alt_result"><span class="annot"><span class="annottext">forall a. CaseAlt a -&gt; MatchResult CoreExpr
</span><a href="GHC.HsToCore.Utils.html#alt_result"><span class="hs-identifier hs-var hs-var">alt_result</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#MatchResult"><span class="hs-identifier hs-type">MatchResult</span></a></span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-291"></span><span>
</span><span id="line-292"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkCoAlgCaseMatchResult"><span class="hs-identifier hs-type">mkCoAlgCaseMatchResult</span></a></span><span>
</span><span id="line-293"></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span> </span><span class="hs-comment">-- ^ Scrutinee</span><span>
</span><span id="line-294"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-comment">-- ^ Type of exp</span><span>
</span><span id="line-295"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#NonEmpty"><span class="hs-identifier hs-type">NonEmpty</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.Utils.html#CaseAlt"><span class="hs-identifier hs-type">CaseAlt</span></a></span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html#DataCon"><span class="hs-identifier hs-type">DataCon</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- ^ Alternatives (bndrs *include* tyvars, dicts)</span><span>
</span><span id="line-296"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#MatchResult"><span class="hs-identifier hs-type">MatchResult</span></a></span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span>
</span><span id="line-297"></span><span id="mkCoAlgCaseMatchResult"><span class="annot"><span class="annottext">mkCoAlgCaseMatchResult :: Id -&gt; Mult -&gt; NonEmpty (CaseAlt DataCon) -&gt; MatchResult CoreExpr
</span><a href="GHC.HsToCore.Utils.html#mkCoAlgCaseMatchResult"><span class="hs-identifier hs-var hs-var">mkCoAlgCaseMatchResult</span></a></span></span><span> </span><span id="local-6989586621681142792"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142792"><span class="hs-identifier hs-var">var</span></a></span></span><span> </span><span id="local-6989586621681142791"><span class="annot"><span class="annottext">Mult
</span><a href="#local-6989586621681142791"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span id="local-6989586621681142790"><span class="annot"><span class="annottext">NonEmpty (CaseAlt DataCon)
</span><a href="#local-6989586621681142790"><span class="hs-identifier hs-var">match_alts</span></a></span></span><span>
</span><span id="line-298"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681142789"><span class="hs-identifier hs-var">isNewtype</span></a></span><span>  </span><span class="hs-comment">-- Newtype case; use a let</span><span>
</span><span id="line-299"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">null</span><span> </span><span class="hs-identifier">match_alts_tail</span><span> </span><span class="hs-operator">&amp;&amp;</span><span> </span><span class="hs-identifier">null</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">tail</span><span> </span><span class="hs-identifier">arg_ids1</span><span class="hs-special">)</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-300"></span><span>    </span><span class="annot"><span class="annottext">Bind Id -&gt; MatchResult CoreExpr -&gt; MatchResult CoreExpr
</span><a href="GHC.HsToCore.Utils.html#mkCoLetMatchResult"><span class="hs-identifier hs-var">mkCoLetMatchResult</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; CoreExpr -&gt; Bind Id
forall b. b -&gt; Expr b -&gt; Bind b
</span><a href="GHC.Core.html#NonRec"><span class="hs-identifier hs-var">NonRec</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142785"><span class="hs-identifier hs-var">arg_id1</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142784"><span class="hs-identifier hs-var">newtype_rhs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">MatchResult CoreExpr
</span><a href="#local-6989586621681142783"><span class="hs-identifier hs-var">match_result1</span></a></span><span>
</span><span id="line-301"></span><span>
</span><span id="line-302"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-303"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; Mult -&gt; NonEmpty (CaseAlt DataCon) -&gt; MatchResult CoreExpr
</span><a href="GHC.HsToCore.Utils.html#mkDataConCase"><span class="hs-identifier hs-var">mkDataConCase</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142792"><span class="hs-identifier hs-var">var</span></a></span><span> </span><span class="annot"><span class="annottext">Mult
</span><a href="#local-6989586621681142791"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">NonEmpty (CaseAlt DataCon)
</span><a href="#local-6989586621681142790"><span class="hs-identifier hs-var">match_alts</span></a></span><span>
</span><span id="line-304"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-305"></span><span>    </span><span id="local-6989586621681142789"><span class="annot"><span class="annottext">isNewtype :: Bool
</span><a href="#local-6989586621681142789"><span class="hs-identifier hs-var hs-var">isNewtype</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isNewTyCon"><span class="hs-identifier hs-var">isNewTyCon</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DataCon -&gt; TyCon
</span><a href="GHC.Core.DataCon.html#dataConTyCon"><span class="hs-identifier hs-var">dataConTyCon</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CaseAlt DataCon -&gt; DataCon
forall a. CaseAlt a -&gt; a
</span><a href="GHC.HsToCore.Utils.html#alt_pat"><span class="hs-identifier hs-var hs-var">alt_pat</span></a></span><span> </span><span class="annot"><span class="annottext">CaseAlt DataCon
</span><a href="#local-6989586621681142779"><span class="hs-identifier hs-var">alt1</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-306"></span><span>
</span><span id="line-307"></span><span>        </span><span class="hs-comment">-- [Interesting: because of GADTs, we can't rely on the type of</span><span>
</span><span id="line-308"></span><span>        </span><span class="hs-comment">--  the scrutinised Id to be sufficiently refined to have a TyCon in it]</span><span>
</span><span id="line-309"></span><span>
</span><span id="line-310"></span><span>    </span><span id="local-6989586621681142779"><span class="annot"><span class="annottext">alt1 :: CaseAlt DataCon
</span><a href="#local-6989586621681142779"><span class="hs-identifier hs-var">alt1</span></a></span></span><span class="hs-glyph">@</span><span class="annot"><a href="GHC.HsToCore.Utils.html#MkCaseAlt"><span class="hs-identifier hs-type">MkCaseAlt</span></a></span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">alt_bndrs :: forall a. CaseAlt a -&gt; [Id]
</span><a href="GHC.HsToCore.Utils.html#alt_bndrs"><span class="hs-identifier hs-var">alt_bndrs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681142786"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681142786"><span class="hs-identifier hs-var">arg_ids1</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">alt_result :: forall a. CaseAlt a -&gt; MatchResult CoreExpr
</span><a href="GHC.HsToCore.Utils.html#alt_result"><span class="hs-identifier hs-var">alt_result</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681142783"><span class="annot"><span class="annottext">MatchResult CoreExpr
</span><a href="#local-6989586621681142783"><span class="hs-identifier hs-var">match_result1</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#%3A%7C"><span class="hs-operator hs-type">:|</span></a></span><span> </span><span id="local-6989586621681142787"><span class="annot"><span class="annottext">[CaseAlt DataCon]
</span><a href="#local-6989586621681142787"><span class="hs-identifier hs-var">match_alts_tail</span></a></span></span><span>
</span><span id="line-311"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">NonEmpty (CaseAlt DataCon)
</span><a href="#local-6989586621681142790"><span class="hs-identifier hs-var">match_alts</span></a></span><span>
</span><span id="line-312"></span><span>    </span><span class="hs-comment">-- Stuff for newtype</span><span>
</span><span id="line-313"></span><span>    </span><span id="local-6989586621681142785"><span class="annot"><span class="annottext">arg_id1 :: Id
</span><a href="#local-6989586621681142785"><span class="hs-identifier hs-var hs-var">arg_id1</span></a></span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">notNull</span><span> </span><span class="hs-identifier">arg_ids1</span><span> </span><span class="hs-special">)</span><span> </span><span class="hs-identifier">head</span><span> </span><span class="hs-identifier">arg_ids1</span><span>
</span><span id="line-314"></span><span>    </span><span id="local-6989586621681142777"><span class="annot"><span class="annottext">var_ty :: Mult
</span><a href="#local-6989586621681142777"><span class="hs-identifier hs-var hs-var">var_ty</span></a></span></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; Mult
</span><a href="GHC.Types.Id.html#idType"><span class="hs-identifier hs-var">idType</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142792"><span class="hs-identifier hs-var">var</span></a></span><span>
</span><span id="line-315"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681142775"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681142775"><span class="hs-identifier hs-var">tc</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681142774"><span class="annot"><span class="annottext">[Mult]
</span><a href="#local-6989586621681142774"><span class="hs-identifier hs-var">ty_args</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Mult -&gt; (TyCon, [Mult])
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitTyConApp"><span class="hs-identifier hs-var">tcSplitTyConApp</span></a></span><span> </span><span class="annot"><span class="annottext">Mult
</span><a href="#local-6989586621681142777"><span class="hs-identifier hs-var">var_ty</span></a></span><span>      </span><span class="hs-comment">-- Don't look through newtypes</span><span>
</span><span id="line-316"></span><span>                                                </span><span class="hs-comment">-- (not that splitTyConApp does, these days)</span><span>
</span><span id="line-317"></span><span>    </span><span id="local-6989586621681142784"><span class="annot"><span class="annottext">newtype_rhs :: CoreExpr
</span><a href="#local-6989586621681142784"><span class="hs-identifier hs-var hs-var">newtype_rhs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [Mult] -&gt; CoreExpr -&gt; CoreExpr
</span><a href="GHC.Types.Id.Make.html#unwrapNewTypeBody"><span class="hs-identifier hs-var">unwrapNewTypeBody</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681142775"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">[Mult]
</span><a href="#local-6989586621681142774"><span class="hs-identifier hs-var">ty_args</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; CoreExpr
forall b. Id -&gt; Expr b
</span><a href="GHC.Core.html#Var"><span class="hs-identifier hs-var">Var</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142792"><span class="hs-identifier hs-var">var</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-318"></span><span>
</span><span id="line-319"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkCoSynCaseMatchResult"><span class="hs-identifier hs-type">mkCoSynCaseMatchResult</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.HsToCore.Utils.html#CaseAlt"><span class="hs-identifier hs-type">CaseAlt</span></a></span><span> </span><span class="annot"><a href="GHC.Core.PatSyn.html#PatSyn"><span class="hs-identifier hs-type">PatSyn</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#MatchResult"><span class="hs-identifier hs-type">MatchResult</span></a></span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span>
</span><span id="line-320"></span><span id="mkCoSynCaseMatchResult"><span class="annot"><span class="annottext">mkCoSynCaseMatchResult :: Id -&gt; Mult -&gt; CaseAlt PatSyn -&gt; MatchResult CoreExpr
</span><a href="GHC.HsToCore.Utils.html#mkCoSynCaseMatchResult"><span class="hs-identifier hs-var hs-var">mkCoSynCaseMatchResult</span></a></span></span><span> </span><span id="local-6989586621681142772"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142772"><span class="hs-identifier hs-var">var</span></a></span></span><span> </span><span id="local-6989586621681142771"><span class="annot"><span class="annottext">Mult
</span><a href="#local-6989586621681142771"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span id="local-6989586621681142770"><span class="annot"><span class="annottext">CaseAlt PatSyn
</span><a href="#local-6989586621681142770"><span class="hs-identifier hs-var">alt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(CoreExpr -&gt; DsM CoreExpr) -&gt; MatchResult CoreExpr
forall a. (CoreExpr -&gt; DsM a) -&gt; MatchResult a
</span><a href="GHC.HsToCore.Monad.html#MR_Fallible"><span class="hs-identifier hs-var">MR_Fallible</span></a></span><span> </span><span class="annot"><span class="annottext">((CoreExpr -&gt; DsM CoreExpr) -&gt; MatchResult CoreExpr)
-&gt; (CoreExpr -&gt; DsM CoreExpr) -&gt; MatchResult CoreExpr
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Id -&gt; Mult -&gt; CaseAlt PatSyn -&gt; CoreExpr -&gt; DsM CoreExpr
</span><a href="GHC.HsToCore.Utils.html#mkPatSynCase"><span class="hs-identifier hs-var">mkPatSynCase</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142772"><span class="hs-identifier hs-var">var</span></a></span><span> </span><span class="annot"><span class="annottext">Mult
</span><a href="#local-6989586621681142771"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">CaseAlt PatSyn
</span><a href="#local-6989586621681142770"><span class="hs-identifier hs-var">alt</span></a></span><span>
</span><span id="line-321"></span><span>
</span><span id="line-322"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkPatSynCase"><span class="hs-identifier hs-type">mkPatSynCase</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.HsToCore.Utils.html#CaseAlt"><span class="hs-identifier hs-type">CaseAlt</span></a></span><span> </span><span class="annot"><a href="GHC.Core.PatSyn.html#PatSyn"><span class="hs-identifier hs-type">PatSyn</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span>
</span><span id="line-323"></span><span id="mkPatSynCase"><span class="annot"><span class="annottext">mkPatSynCase :: Id -&gt; Mult -&gt; CaseAlt PatSyn -&gt; CoreExpr -&gt; DsM CoreExpr
</span><a href="GHC.HsToCore.Utils.html#mkPatSynCase"><span class="hs-identifier hs-var hs-var">mkPatSynCase</span></a></span></span><span> </span><span id="local-6989586621681142768"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142768"><span class="hs-identifier hs-var">var</span></a></span></span><span> </span><span id="local-6989586621681142767"><span class="annot"><span class="annottext">Mult
</span><a href="#local-6989586621681142767"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span id="local-6989586621681142766"><span class="annot"><span class="annottext">CaseAlt PatSyn
</span><a href="#local-6989586621681142766"><span class="hs-identifier hs-var">alt</span></a></span></span><span> </span><span id="local-6989586621681142765"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142765"><span class="hs-identifier hs-var">fail</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-324"></span><span>    </span><span id="local-6989586621681142764"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142764"><span class="hs-identifier hs-var">matcher</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked) -&gt; DsM CoreExpr
</span><a href="GHC.HsToCore.Expr.html#dsLExpr"><span class="hs-identifier hs-var">dsLExpr</span></a></span><span> </span><span class="annot"><span class="annottext">(LHsExpr (GhcPass 'Typechecked) -&gt; DsM CoreExpr)
-&gt; LHsExpr (GhcPass 'Typechecked) -&gt; DsM CoreExpr
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">HsWrapper
-&gt; LHsExpr (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked)
</span><a href="GHC.Hs.Utils.html#mkLHsWrap"><span class="hs-identifier hs-var">mkLHsWrap</span></a></span><span> </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681142762"><span class="hs-identifier hs-var">wrapper</span></a></span><span> </span><span class="annot"><span class="annottext">(LHsExpr (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked))
-&gt; LHsExpr (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-325"></span><span>                         </span><span class="annot"><span class="annottext">Id -&gt; [Mult] -&gt; LHsExpr (GhcPass 'Typechecked)
</span><a href="GHC.Hs.Utils.html#nlHsTyApp"><span class="hs-identifier hs-var">nlHsTyApp</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142760"><span class="hs-identifier hs-var">matcher</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Mult -&gt; Mult
Mult -&gt; Mult
</span><a href="GHC.Core.Type.html#getRuntimeRep"><span class="hs-identifier hs-var">getRuntimeRep</span></a></span><span> </span><span class="annot"><span class="annottext">Mult
</span><a href="#local-6989586621681142767"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Mult
</span><a href="#local-6989586621681142767"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-326"></span><span>    </span><span id="local-6989586621681142758"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142758"><span class="hs-identifier hs-var">cont</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Id] -&gt; CoreExpr -&gt; CoreExpr
</span><a href="GHC.Core.Make.html#mkCoreLams"><span class="hs-identifier hs-var">mkCoreLams</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681142756"><span class="hs-identifier hs-var">bndrs</span></a></span><span> </span><span class="annot"><span class="annottext">(CoreExpr -&gt; CoreExpr) -&gt; DsM CoreExpr -&gt; DsM CoreExpr
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr -&gt; MatchResult CoreExpr -&gt; DsM CoreExpr
forall a. CoreExpr -&gt; MatchResult a -&gt; DsM a
</span><a href="GHC.HsToCore.Monad.html#runMatchResult"><span class="hs-identifier hs-var">runMatchResult</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142765"><span class="hs-identifier hs-var">fail</span></a></span><span> </span><span class="annot"><span class="annottext">MatchResult CoreExpr
</span><a href="#local-6989586621681142754"><span class="hs-identifier hs-var">match_result</span></a></span><span>
</span><span id="line-327"></span><span>    </span><span class="annot"><span class="annottext">CoreExpr -&gt; DsM CoreExpr
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(CoreExpr -&gt; DsM CoreExpr) -&gt; CoreExpr -&gt; DsM CoreExpr
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; CoreExpr -&gt; [CoreExpr] -&gt; CoreExpr
</span><a href="GHC.HsToCore.Utils.html#mkCoreAppsDs"><span class="hs-identifier hs-var">mkCoreAppsDs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;patsyn&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Id -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142768"><span class="hs-identifier hs-var">var</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142764"><span class="hs-identifier hs-var">matcher</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Id -&gt; CoreExpr
forall b. Id -&gt; Expr b
</span><a href="GHC.Core.html#Var"><span class="hs-identifier hs-var">Var</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142768"><span class="hs-identifier hs-var">var</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CoreExpr -&gt; CoreExpr
</span><a href="#local-6989586621681142750"><span class="hs-identifier hs-var">ensure_unstrict</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142758"><span class="hs-identifier hs-var">cont</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Id -&gt; CoreExpr -&gt; CoreExpr
forall b. b -&gt; Expr b -&gt; Expr b
</span><a href="GHC.Core.html#Lam"><span class="hs-identifier hs-var">Lam</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="GHC.Types.Id.Make.html#voidArgId"><span class="hs-identifier hs-var">voidArgId</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142765"><span class="hs-identifier hs-var">fail</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-328"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-329"></span><span>    </span><span class="annot"><a href="GHC.HsToCore.Utils.html#MkCaseAlt"><span class="hs-identifier hs-type">MkCaseAlt</span></a></span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">alt_pat :: forall a. CaseAlt a -&gt; a
</span><a href="GHC.HsToCore.Utils.html#alt_pat"><span class="hs-identifier hs-var">alt_pat</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681142747"><span class="annot"><span class="annottext">PatSyn
</span><a href="#local-6989586621681142747"><span class="hs-identifier hs-var">psyn</span></a></span></span><span class="hs-special">,</span><span>
</span><span id="line-330"></span><span>               </span><span class="annot"><span class="annottext">alt_bndrs :: forall a. CaseAlt a -&gt; [Id]
</span><a href="GHC.HsToCore.Utils.html#alt_bndrs"><span class="hs-identifier hs-var">alt_bndrs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681142756"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681142756"><span class="hs-identifier hs-var">bndrs</span></a></span></span><span class="hs-special">,</span><span>
</span><span id="line-331"></span><span>               </span><span class="annot"><span class="annottext">alt_wrapper :: forall a. CaseAlt a -&gt; HsWrapper
</span><a href="GHC.HsToCore.Utils.html#alt_wrapper"><span class="hs-identifier hs-var">alt_wrapper</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681142762"><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681142762"><span class="hs-identifier hs-var">wrapper</span></a></span></span><span class="hs-special">,</span><span>
</span><span id="line-332"></span><span>               </span><span class="annot"><span class="annottext">alt_result :: forall a. CaseAlt a -&gt; MatchResult CoreExpr
</span><a href="GHC.HsToCore.Utils.html#alt_result"><span class="hs-identifier hs-var">alt_result</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681142754"><span class="annot"><span class="annottext">MatchResult CoreExpr
</span><a href="#local-6989586621681142754"><span class="hs-identifier hs-var">match_result</span></a></span></span><span class="hs-special">}</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CaseAlt PatSyn
</span><a href="#local-6989586621681142766"><span class="hs-identifier hs-var">alt</span></a></span><span>
</span><span id="line-333"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681142760"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142760"><span class="hs-identifier hs-var">matcher</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681142746"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681142746"><span class="hs-identifier hs-var">needs_void_lam</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">PatSyn -&gt; (Id, Bool)
</span><a href="GHC.Core.PatSyn.html#patSynMatcher"><span class="hs-identifier hs-var">patSynMatcher</span></a></span><span> </span><span class="annot"><span class="annottext">PatSyn
</span><a href="#local-6989586621681142747"><span class="hs-identifier hs-var">psyn</span></a></span><span>
</span><span id="line-334"></span><span>
</span><span id="line-335"></span><span>    </span><span class="hs-comment">-- See Note [Matchers and builders for pattern synonyms] in GHC.Core.PatSyn</span><span>
</span><span id="line-336"></span><span>    </span><span class="hs-comment">-- on these extra Void# arguments</span><span>
</span><span id="line-337"></span><span>    </span><span id="local-6989586621681142750"><span class="annot"><span class="annottext">ensure_unstrict :: CoreExpr -&gt; CoreExpr
</span><a href="#local-6989586621681142750"><span class="hs-identifier hs-var hs-var">ensure_unstrict</span></a></span></span><span> </span><span id="local-6989586621681142744"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142744"><span class="hs-identifier hs-var">cont</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681142746"><span class="hs-identifier hs-var">needs_void_lam</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; CoreExpr -&gt; CoreExpr
forall b. b -&gt; Expr b -&gt; Expr b
</span><a href="GHC.Core.html#Lam"><span class="hs-identifier hs-var">Lam</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="GHC.Types.Id.Make.html#voidArgId"><span class="hs-identifier hs-var">voidArgId</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142744"><span class="hs-identifier hs-var">cont</span></a></span><span>
</span><span id="line-338"></span><span>                         </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142744"><span class="hs-identifier hs-var">cont</span></a></span><span>
</span><span id="line-339"></span><span>
</span><span id="line-340"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkDataConCase"><span class="hs-identifier hs-type">mkDataConCase</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#NonEmpty"><span class="hs-identifier hs-type">NonEmpty</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.Utils.html#CaseAlt"><span class="hs-identifier hs-type">CaseAlt</span></a></span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html#DataCon"><span class="hs-identifier hs-type">DataCon</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#MatchResult"><span class="hs-identifier hs-type">MatchResult</span></a></span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span>
</span><span id="line-341"></span><span id="mkDataConCase"><span class="annot"><span class="annottext">mkDataConCase :: Id -&gt; Mult -&gt; NonEmpty (CaseAlt DataCon) -&gt; MatchResult CoreExpr
</span><a href="GHC.HsToCore.Utils.html#mkDataConCase"><span class="hs-identifier hs-var hs-var">mkDataConCase</span></a></span></span><span> </span><span id="local-6989586621681142743"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142743"><span class="hs-identifier hs-var">var</span></a></span></span><span> </span><span id="local-6989586621681142742"><span class="annot"><span class="annottext">Mult
</span><a href="#local-6989586621681142742"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span id="local-6989586621681142741"><span class="annot"><span class="annottext">alts :: NonEmpty (CaseAlt DataCon)
</span><a href="#local-6989586621681142741"><span class="hs-identifier hs-var">alts</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span id="local-6989586621681142740"><span class="annot"><span class="annottext">CaseAlt DataCon
</span><a href="#local-6989586621681142740"><span class="hs-identifier hs-var">alt1</span></a></span></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#%3A%7C"><span class="hs-operator hs-type">:|</span></a></span><span> </span><span class="annot"><span class="annottext">[CaseAlt DataCon]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>
</span><span id="line-342"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Maybe (Alt Id) -&gt; [Alt Id] -&gt; CoreExpr)
-&gt; MatchResult (Maybe (Alt Id))
-&gt; MatchResult [Alt Id]
-&gt; MatchResult CoreExpr
forall (f :: * -&gt; *) a b c.
Applicative f =&gt;
(a -&gt; b -&gt; c) -&gt; f a -&gt; f b -&gt; f c
</span><a href="../../base/src/GHC.Base.html#liftA2"><span class="hs-identifier hs-var">liftA2</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe (Alt Id) -&gt; [Alt Id] -&gt; CoreExpr
</span><a href="#local-6989586621681142738"><span class="hs-identifier hs-var">mk_case</span></a></span><span> </span><span class="annot"><span class="annottext">MatchResult (Maybe (Alt Id))
</span><a href="#local-6989586621681142737"><span class="hs-identifier hs-var">mk_default</span></a></span><span> </span><span class="annot"><span class="annottext">MatchResult [Alt Id]
</span><a href="#local-6989586621681142736"><span class="hs-identifier hs-var">mk_alts</span></a></span><span>
</span><span id="line-343"></span><span>    </span><span class="hs-comment">-- The liftA2 combines the failability of all the alternatives and the default</span><span>
</span><span id="line-344"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-345"></span><span>    </span><span id="local-6989586621681142735"><span class="annot"><span class="annottext">con1 :: DataCon
</span><a href="#local-6989586621681142735"><span class="hs-identifier hs-var hs-var">con1</span></a></span></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CaseAlt DataCon -&gt; DataCon
forall a. CaseAlt a -&gt; a
</span><a href="GHC.HsToCore.Utils.html#alt_pat"><span class="hs-identifier hs-var hs-var">alt_pat</span></a></span><span> </span><span class="annot"><span class="annottext">CaseAlt DataCon
</span><a href="#local-6989586621681142740"><span class="hs-identifier hs-var">alt1</span></a></span><span>
</span><span id="line-346"></span><span>    </span><span id="local-6989586621681142734"><span class="annot"><span class="annottext">tycon :: TyCon
</span><a href="#local-6989586621681142734"><span class="hs-identifier hs-var hs-var">tycon</span></a></span></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; TyCon
</span><a href="GHC.Core.DataCon.html#dataConTyCon"><span class="hs-identifier hs-var">dataConTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681142735"><span class="hs-identifier hs-var">con1</span></a></span><span>
</span><span id="line-347"></span><span>    </span><span id="local-6989586621681142733"><span class="annot"><span class="annottext">data_cons :: [DataCon]
</span><a href="#local-6989586621681142733"><span class="hs-identifier hs-var hs-var">data_cons</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [DataCon]
</span><a href="GHC.Core.TyCon.html#tyConDataCons"><span class="hs-identifier hs-var">tyConDataCons</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681142734"><span class="hs-identifier hs-var">tycon</span></a></span><span>
</span><span id="line-348"></span><span>
</span><span id="line-349"></span><span>    </span><span class="annot"><a href="#local-6989586621681142731"><span class="hs-identifier hs-type">sorted_alts</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><a href="GHC.HsToCore.Utils.html#CaseAlt"><span class="hs-identifier hs-type">CaseAlt</span></a></span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html#DataCon"><span class="hs-identifier hs-type">DataCon</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-350"></span><span>    </span><span id="local-6989586621681142731"><span class="annot"><span class="annottext">sorted_alts :: [CaseAlt DataCon]
</span><a href="#local-6989586621681142731"><span class="hs-identifier hs-var hs-var">sorted_alts</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(CaseAlt DataCon -&gt; ConTag)
-&gt; [CaseAlt DataCon] -&gt; [CaseAlt DataCon]
forall b a. Ord b =&gt; (a -&gt; b) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Exts.html#sortWith"><span class="hs-identifier hs-var">sortWith</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DataCon -&gt; ConTag
</span><a href="GHC.Core.DataCon.html#dataConTag"><span class="hs-identifier hs-var">dataConTag</span></a></span><span> </span><span class="annot"><span class="annottext">(DataCon -&gt; ConTag)
-&gt; (CaseAlt DataCon -&gt; DataCon) -&gt; CaseAlt DataCon -&gt; ConTag
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">CaseAlt DataCon -&gt; DataCon
forall a. CaseAlt a -&gt; a
</span><a href="GHC.HsToCore.Utils.html#alt_pat"><span class="hs-identifier hs-var hs-var">alt_pat</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">([CaseAlt DataCon] -&gt; [CaseAlt DataCon])
-&gt; [CaseAlt DataCon] -&gt; [CaseAlt DataCon]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">NonEmpty (CaseAlt DataCon) -&gt; [CaseAlt DataCon]
forall a. NonEmpty a -&gt; [a]
</span><a href="../../base/src/Data.List.NonEmpty.html#toList"><span class="hs-identifier hs-var">NEL.toList</span></a></span><span> </span><span class="annot"><span class="annottext">NonEmpty (CaseAlt DataCon)
</span><a href="#local-6989586621681142741"><span class="hs-identifier hs-var">alts</span></a></span><span>
</span><span id="line-351"></span><span>
</span><span id="line-352"></span><span>    </span><span id="local-6989586621681142727"><span class="annot"><span class="annottext">var_ty :: Mult
</span><a href="#local-6989586621681142727"><span class="hs-identifier hs-var hs-var">var_ty</span></a></span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; Mult
</span><a href="GHC.Types.Id.html#idType"><span class="hs-identifier hs-var">idType</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142743"><span class="hs-identifier hs-var">var</span></a></span><span>
</span><span id="line-353"></span><span>    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681142726"><span class="annot"><span class="annottext">[Mult]
</span><a href="#local-6989586621681142726"><span class="hs-identifier hs-var">ty_args</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Mult -&gt; (TyCon, [Mult])
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitTyConApp"><span class="hs-identifier hs-var">tcSplitTyConApp</span></a></span><span> </span><span class="annot"><span class="annottext">Mult
</span><a href="#local-6989586621681142727"><span class="hs-identifier hs-var">var_ty</span></a></span><span> </span><span class="hs-comment">-- Don't look through newtypes</span><span>
</span><span id="line-354"></span><span>                                          </span><span class="hs-comment">-- (not that splitTyConApp does, these days)</span><span>
</span><span id="line-355"></span><span>
</span><span id="line-356"></span><span>    </span><span class="annot"><a href="#local-6989586621681142738"><span class="hs-identifier hs-type">mk_case</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Core.html#CoreAlt"><span class="hs-identifier hs-type">CoreAlt</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.html#CoreAlt"><span class="hs-identifier hs-type">CoreAlt</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span>
</span><span id="line-357"></span><span>    </span><span id="local-6989586621681142738"><span class="annot"><span class="annottext">mk_case :: Maybe (Alt Id) -&gt; [Alt Id] -&gt; CoreExpr
</span><a href="#local-6989586621681142738"><span class="hs-identifier hs-var hs-var">mk_case</span></a></span></span><span> </span><span id="local-6989586621681142724"><span class="annot"><span class="annottext">Maybe (Alt Id)
</span><a href="#local-6989586621681142724"><span class="hs-identifier hs-var">def</span></a></span></span><span> </span><span id="local-6989586621681142723"><span class="annot"><span class="annottext">[Alt Id]
</span><a href="#local-6989586621681142723"><span class="hs-identifier hs-var">alts</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoreExpr -&gt; Scaled Mult -&gt; Mult -&gt; [Alt Id] -&gt; CoreExpr
</span><a href="GHC.Core.Make.html#mkWildCase"><span class="hs-identifier hs-var">mkWildCase</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; CoreExpr
forall b. Id -&gt; Expr b
</span><a href="GHC.Core.html#Var"><span class="hs-identifier hs-var">Var</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142743"><span class="hs-identifier hs-var">var</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; Scaled Mult
</span><a href="GHC.Types.Id.html#idScaledType"><span class="hs-identifier hs-var">idScaledType</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142743"><span class="hs-identifier hs-var">var</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Mult
</span><a href="#local-6989586621681142742"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">([Alt Id] -&gt; CoreExpr) -&gt; [Alt Id] -&gt; CoreExpr
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-358"></span><span>      </span><span class="annot"><span class="annottext">Maybe (Alt Id) -&gt; [Alt Id]
forall a. Maybe a -&gt; [a]
</span><a href="../../base/src/Data.Maybe.html#maybeToList"><span class="hs-identifier hs-var">maybeToList</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe (Alt Id)
</span><a href="#local-6989586621681142724"><span class="hs-identifier hs-var">def</span></a></span><span> </span><span class="annot"><span class="annottext">[Alt Id] -&gt; [Alt Id] -&gt; [Alt Id]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[Alt Id]
</span><a href="#local-6989586621681142723"><span class="hs-identifier hs-var">alts</span></a></span><span>
</span><span id="line-359"></span><span>
</span><span id="line-360"></span><span>    </span><span class="annot"><a href="#local-6989586621681142736"><span class="hs-identifier hs-type">mk_alts</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#MatchResult"><span class="hs-identifier hs-type">MatchResult</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.html#CoreAlt"><span class="hs-identifier hs-type">CoreAlt</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-361"></span><span>    </span><span id="local-6989586621681142736"><span class="annot"><span class="annottext">mk_alts :: MatchResult [Alt Id]
</span><a href="#local-6989586621681142736"><span class="hs-identifier hs-var hs-var">mk_alts</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(CaseAlt DataCon -&gt; MatchResult (Alt Id))
-&gt; [CaseAlt DataCon] -&gt; MatchResult [Alt Id]
forall (t :: * -&gt; *) (f :: * -&gt; *) a b.
(Traversable t, Applicative f) =&gt;
(a -&gt; f b) -&gt; t a -&gt; f (t b)
</span><a href="../../base/src/Data.Traversable.html#traverse"><span class="hs-identifier hs-var">traverse</span></a></span><span> </span><span class="annot"><span class="annottext">CaseAlt DataCon -&gt; MatchResult (Alt Id)
</span><a href="#local-6989586621681142719"><span class="hs-identifier hs-var">mk_alt</span></a></span><span> </span><span class="annot"><span class="annottext">[CaseAlt DataCon]
</span><a href="#local-6989586621681142731"><span class="hs-identifier hs-var">sorted_alts</span></a></span><span>
</span><span id="line-362"></span><span>
</span><span id="line-363"></span><span>    </span><span class="annot"><a href="#local-6989586621681142719"><span class="hs-identifier hs-type">mk_alt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.HsToCore.Utils.html#CaseAlt"><span class="hs-identifier hs-type">CaseAlt</span></a></span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html#DataCon"><span class="hs-identifier hs-type">DataCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#MatchResult"><span class="hs-identifier hs-type">MatchResult</span></a></span><span> </span><span class="annot"><a href="GHC.Core.html#CoreAlt"><span class="hs-identifier hs-type">CoreAlt</span></a></span><span>
</span><span id="line-364"></span><span>    </span><span id="local-6989586621681142719"><span class="annot"><span class="annottext">mk_alt :: CaseAlt DataCon -&gt; MatchResult (Alt Id)
</span><a href="#local-6989586621681142719"><span class="hs-identifier hs-var hs-var">mk_alt</span></a></span></span><span> </span><span class="annot"><a href="GHC.HsToCore.Utils.html#MkCaseAlt"><span class="hs-identifier hs-type">MkCaseAlt</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">alt_pat :: forall a. CaseAlt a -&gt; a
</span><a href="GHC.HsToCore.Utils.html#alt_pat"><span class="hs-identifier hs-var">alt_pat</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681142718"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681142718"><span class="hs-identifier hs-var">con</span></a></span></span><span>
</span><span id="line-365"></span><span>                     </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">alt_bndrs :: forall a. CaseAlt a -&gt; [Id]
</span><a href="GHC.HsToCore.Utils.html#alt_bndrs"><span class="hs-identifier hs-var">alt_bndrs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681142717"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681142717"><span class="hs-identifier hs-var">args</span></a></span></span><span>
</span><span id="line-366"></span><span>                     </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">alt_result :: forall a. CaseAlt a -&gt; MatchResult CoreExpr
</span><a href="GHC.HsToCore.Utils.html#alt_result"><span class="hs-identifier hs-var">alt_result</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681142716"><span class="annot"><span class="annottext">MatchResult CoreExpr
</span><a href="#local-6989586621681142716"><span class="hs-identifier hs-var">match_result</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-367"></span><span>      </span><span class="annot"><span class="annottext">((CoreExpr -&gt; IOEnv (Env DsGblEnv DsLclEnv) (Alt Id))
 -&gt; MatchResult CoreExpr -&gt; MatchResult (Alt Id))
-&gt; MatchResult CoreExpr
-&gt; (CoreExpr -&gt; IOEnv (Env DsGblEnv DsLclEnv) (Alt Id))
-&gt; MatchResult (Alt Id)
forall a b c. (a -&gt; b -&gt; c) -&gt; b -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#flip"><span class="hs-identifier hs-var">flip</span></a></span><span> </span><span class="annot"><span class="annottext">(CoreExpr -&gt; IOEnv (Env DsGblEnv DsLclEnv) (Alt Id))
-&gt; MatchResult CoreExpr -&gt; MatchResult (Alt Id)
forall a b. (a -&gt; DsM b) -&gt; MatchResult a -&gt; MatchResult b
</span><a href="GHC.HsToCore.Utils.html#adjustMatchResultDs"><span class="hs-identifier hs-var">adjustMatchResultDs</span></a></span><span> </span><span class="annot"><span class="annottext">MatchResult CoreExpr
</span><a href="#local-6989586621681142716"><span class="hs-identifier hs-var">match_result</span></a></span><span> </span><span class="annot"><span class="annottext">((CoreExpr -&gt; IOEnv (Env DsGblEnv DsLclEnv) (Alt Id))
 -&gt; MatchResult (Alt Id))
-&gt; (CoreExpr -&gt; IOEnv (Env DsGblEnv DsLclEnv) (Alt Id))
-&gt; MatchResult (Alt Id)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681142714"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142714"><span class="hs-identifier hs-var">body</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-368"></span><span>        </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; Maybe DataConBoxer
</span><a href="GHC.Core.DataCon.html#dataConBoxer"><span class="hs-identifier hs-var">dataConBoxer</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681142718"><span class="hs-identifier hs-var">con</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-369"></span><span>          </span><span class="annot"><span class="annottext">Maybe DataConBoxer
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Alt Id -&gt; IOEnv (Env DsGblEnv DsLclEnv) (Alt Id)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DataCon -&gt; AltCon
</span><a href="GHC.Core.html#DataAlt"><span class="hs-identifier hs-var">DataAlt</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681142718"><span class="hs-identifier hs-var">con</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681142717"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142714"><span class="hs-identifier hs-var">body</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-370"></span><span>          </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Id.Make.html#DCB"><span class="hs-identifier hs-type">DCB</span></a></span><span> </span><span id="local-6989586621681142710"><span class="annot"><span class="annottext">[Mult] -&gt; [Id] -&gt; UniqSM ([Id], [Bind Id])
</span><a href="#local-6989586621681142710"><span class="hs-identifier hs-var">boxer</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-371"></span><span>            </span><span id="local-6989586621681142709"><span class="annot"><span class="annottext">UniqSupply
</span><a href="#local-6989586621681142709"><span class="hs-identifier hs-var">us</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRnIf DsGblEnv DsLclEnv UniqSupply
forall gbl lcl. TcRnIf gbl lcl UniqSupply
</span><a href="GHC.Tc.Utils.Monad.html#newUniqueSupply"><span class="hs-identifier hs-var">newUniqueSupply</span></a></span><span>
</span><span id="line-372"></span><span>            </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681142707"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681142707"><span class="hs-identifier hs-var">rep_ids</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681142706"><span class="annot"><span class="annottext">[Bind Id]
</span><a href="#local-6989586621681142706"><span class="hs-identifier hs-var">binds</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqSupply -&gt; UniqSM ([Id], [Bind Id]) -&gt; ([Id], [Bind Id])
forall a. UniqSupply -&gt; UniqSM a -&gt; a
</span><a href="GHC.Types.Unique.Supply.html#initUs_"><span class="hs-identifier hs-var">initUs_</span></a></span><span> </span><span class="annot"><span class="annottext">UniqSupply
</span><a href="#local-6989586621681142709"><span class="hs-identifier hs-var">us</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Mult] -&gt; [Id] -&gt; UniqSM ([Id], [Bind Id])
</span><a href="#local-6989586621681142710"><span class="hs-identifier hs-var">boxer</span></a></span><span> </span><span class="annot"><span class="annottext">[Mult]
</span><a href="#local-6989586621681142726"><span class="hs-identifier hs-var">ty_args</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681142717"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-373"></span><span>            </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681142704"><span class="annot"><span class="annottext">rep_ids' :: [Id]
</span><a href="#local-6989586621681142704"><span class="hs-identifier hs-var hs-var">rep_ids'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Id -&gt; Id) -&gt; [Id] -&gt; [Id]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Mult -&gt; Id -&gt; Id
</span><a href="GHC.Types.Id.html#scaleVarBy"><span class="hs-identifier hs-var">scaleVarBy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; Mult
</span><a href="GHC.Types.Id.html#idMult"><span class="hs-identifier hs-var">idMult</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142743"><span class="hs-identifier hs-var">var</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681142707"><span class="hs-identifier hs-var">rep_ids</span></a></span><span>
</span><span id="line-374"></span><span>              </span><span class="hs-comment">-- Upholds the invariant that the binders of a case expression</span><span>
</span><span id="line-375"></span><span>              </span><span class="hs-comment">-- must be scaled by the case multiplicity. See Note [Case</span><span>
</span><span id="line-376"></span><span>              </span><span class="hs-comment">-- expression invariants] in CoreSyn.</span><span>
</span><span id="line-377"></span><span>            </span><span class="annot"><span class="annottext">Alt Id -&gt; IOEnv (Env DsGblEnv DsLclEnv) (Alt Id)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DataCon -&gt; AltCon
</span><a href="GHC.Core.html#DataAlt"><span class="hs-identifier hs-var">DataAlt</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681142718"><span class="hs-identifier hs-var">con</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681142704"><span class="hs-identifier hs-var">rep_ids'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Bind Id] -&gt; CoreExpr -&gt; CoreExpr
forall b. [Bind b] -&gt; Expr b -&gt; Expr b
</span><a href="GHC.Core.html#mkLets"><span class="hs-identifier hs-var">mkLets</span></a></span><span> </span><span class="annot"><span class="annottext">[Bind Id]
</span><a href="#local-6989586621681142706"><span class="hs-identifier hs-var">binds</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142714"><span class="hs-identifier hs-var">body</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-378"></span><span>
</span><span id="line-379"></span><span>    </span><span class="annot"><a href="#local-6989586621681142737"><span class="hs-identifier hs-type">mk_default</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#MatchResult"><span class="hs-identifier hs-type">MatchResult</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Core.html#CoreAlt"><span class="hs-identifier hs-type">CoreAlt</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-380"></span><span>    </span><span id="local-6989586621681142737"><span class="annot"><span class="annottext">mk_default :: MatchResult (Maybe (Alt Id))
</span><a href="#local-6989586621681142737"><span class="hs-identifier hs-var hs-var">mk_default</span></a></span></span><span>
</span><span id="line-381"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681142700"><span class="hs-identifier hs-var">exhaustive_case</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DsM (Maybe (Alt Id)) -&gt; MatchResult (Maybe (Alt Id))
forall a. DsM a -&gt; MatchResult a
</span><a href="GHC.HsToCore.Monad.html#MR_Infallible"><span class="hs-identifier hs-var">MR_Infallible</span></a></span><span> </span><span class="annot"><span class="annottext">(DsM (Maybe (Alt Id)) -&gt; MatchResult (Maybe (Alt Id)))
-&gt; DsM (Maybe (Alt Id)) -&gt; MatchResult (Maybe (Alt Id))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe (Alt Id) -&gt; DsM (Maybe (Alt Id))
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe (Alt Id)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-382"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(CoreExpr -&gt; DsM (Maybe (Alt Id))) -&gt; MatchResult (Maybe (Alt Id))
forall a. (CoreExpr -&gt; DsM a) -&gt; MatchResult a
</span><a href="GHC.HsToCore.Monad.html#MR_Fallible"><span class="hs-identifier hs-var">MR_Fallible</span></a></span><span> </span><span class="annot"><span class="annottext">((CoreExpr -&gt; DsM (Maybe (Alt Id)))
 -&gt; MatchResult (Maybe (Alt Id)))
-&gt; (CoreExpr -&gt; DsM (Maybe (Alt Id)))
-&gt; MatchResult (Maybe (Alt Id))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681142699"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142699"><span class="hs-identifier hs-var">fail</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe (Alt Id) -&gt; DsM (Maybe (Alt Id))
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(Maybe (Alt Id) -&gt; DsM (Maybe (Alt Id)))
-&gt; Maybe (Alt Id) -&gt; DsM (Maybe (Alt Id))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Alt Id -&gt; Maybe (Alt Id)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">AltCon
</span><a href="GHC.Core.html#DEFAULT"><span class="hs-identifier hs-var">DEFAULT</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142699"><span class="hs-identifier hs-var">fail</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-383"></span><span>
</span><span id="line-384"></span><span>    </span><span id="local-6989586621681142697"><span class="annot"><span class="annottext">mentioned_constructors :: UniqSet DataCon
</span><a href="#local-6989586621681142697"><span class="hs-identifier hs-var hs-var">mentioned_constructors</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[DataCon] -&gt; UniqSet DataCon
forall a. Uniquable a =&gt; [a] -&gt; UniqSet a
</span><a href="GHC.Types.Unique.Set.html#mkUniqSet"><span class="hs-identifier hs-var">mkUniqSet</span></a></span><span> </span><span class="annot"><span class="annottext">([DataCon] -&gt; UniqSet DataCon) -&gt; [DataCon] -&gt; UniqSet DataCon
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(CaseAlt DataCon -&gt; DataCon) -&gt; [CaseAlt DataCon] -&gt; [DataCon]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">CaseAlt DataCon -&gt; DataCon
forall a. CaseAlt a -&gt; a
</span><a href="GHC.HsToCore.Utils.html#alt_pat"><span class="hs-identifier hs-var hs-var">alt_pat</span></a></span><span> </span><span class="annot"><span class="annottext">[CaseAlt DataCon]
</span><a href="#local-6989586621681142731"><span class="hs-identifier hs-var">sorted_alts</span></a></span><span>
</span><span id="line-385"></span><span>    </span><span id="local-6989586621681142695"><span class="annot"><span class="annottext">un_mentioned_constructors :: UniqSet DataCon
</span><a href="#local-6989586621681142695"><span class="hs-identifier hs-var hs-var">un_mentioned_constructors</span></a></span></span><span>
</span><span id="line-386"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[DataCon] -&gt; UniqSet DataCon
forall a. Uniquable a =&gt; [a] -&gt; UniqSet a
</span><a href="GHC.Types.Unique.Set.html#mkUniqSet"><span class="hs-identifier hs-var">mkUniqSet</span></a></span><span> </span><span class="annot"><span class="annottext">[DataCon]
</span><a href="#local-6989586621681142733"><span class="hs-identifier hs-var">data_cons</span></a></span><span> </span><span class="annot"><span class="annottext">UniqSet DataCon -&gt; UniqSet DataCon -&gt; UniqSet DataCon
forall a. UniqSet a -&gt; UniqSet a -&gt; UniqSet a
</span><a href="GHC.Types.Unique.Set.html#minusUniqSet"><span class="hs-operator hs-var">`minusUniqSet`</span></a></span><span> </span><span class="annot"><span class="annottext">UniqSet DataCon
</span><a href="#local-6989586621681142697"><span class="hs-identifier hs-var">mentioned_constructors</span></a></span><span>
</span><span id="line-387"></span><span>    </span><span id="local-6989586621681142700"><span class="annot"><span class="annottext">exhaustive_case :: Bool
</span><a href="#local-6989586621681142700"><span class="hs-identifier hs-var hs-var">exhaustive_case</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqSet DataCon -&gt; Bool
forall a. UniqSet a -&gt; Bool
</span><a href="GHC.Types.Unique.Set.html#isEmptyUniqSet"><span class="hs-identifier hs-var">isEmptyUniqSet</span></a></span><span> </span><span class="annot"><span class="annottext">UniqSet DataCon
</span><a href="#local-6989586621681142695"><span class="hs-identifier hs-var">un_mentioned_constructors</span></a></span><span>
</span><span id="line-388"></span><span>
</span><span id="line-389"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
\subsection{Desugarer's versions of some Core functions}
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-396"></span><span>
</span><span id="line-397"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkErrorAppDs"><span class="hs-identifier hs-type">mkErrorAppDs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span>              </span><span class="hs-comment">-- The error function</span><span>
</span><span id="line-398"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span>            </span><span class="hs-comment">-- Type to which it should be applied</span><span>
</span><span id="line-399"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>            </span><span class="hs-comment">-- The error message string to pass</span><span>
</span><span id="line-400"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span>
</span><span id="line-401"></span><span>
</span><span id="line-402"></span><span id="mkErrorAppDs"><span class="annot"><span class="annottext">mkErrorAppDs :: Id -&gt; Mult -&gt; SDoc -&gt; DsM CoreExpr
</span><a href="GHC.HsToCore.Utils.html#mkErrorAppDs"><span class="hs-identifier hs-var hs-var">mkErrorAppDs</span></a></span></span><span> </span><span id="local-6989586621681142692"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142692"><span class="hs-identifier hs-var">err_id</span></a></span></span><span> </span><span id="local-6989586621681142691"><span class="annot"><span class="annottext">Mult
</span><a href="#local-6989586621681142691"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span id="local-6989586621681142690"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681142690"><span class="hs-identifier hs-var">msg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-403"></span><span>    </span><span id="local-6989586621681142689"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681142689"><span class="hs-identifier hs-var">src_loc</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">DsM SrcSpan
</span><a href="GHC.HsToCore.Monad.html#getSrcSpanDs"><span class="hs-identifier hs-var">getSrcSpanDs</span></a></span><span>
</span><span id="line-404"></span><span>    </span><span id="local-6989586621681142687"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681142687"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IOEnv (Env DsGblEnv DsLclEnv) DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span>
</span><span id="line-405"></span><span>    </span><span class="hs-keyword">let</span><span>
</span><span id="line-406"></span><span>        </span><span id="local-6989586621681142685"><span class="annot"><span class="annottext">full_msg :: String
</span><a href="#local-6989586621681142685"><span class="hs-identifier hs-var hs-var">full_msg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; SDoc -&gt; String
</span><a href="GHC.Utils.Outputable.html#showSDoc"><span class="hs-identifier hs-var">showSDoc</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681142687"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hcat"><span class="hs-identifier hs-var">hcat</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">SrcSpan -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681142689"><span class="hs-identifier hs-var">src_loc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#vbar"><span class="hs-identifier hs-var">vbar</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681142690"><span class="hs-identifier hs-var">msg</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-407"></span><span>        </span><span id="local-6989586621681142681"><span class="annot"><span class="annottext">core_msg :: CoreExpr
</span><a href="#local-6989586621681142681"><span class="hs-identifier hs-var hs-var">core_msg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Literal -&gt; CoreExpr
forall b. Literal -&gt; Expr b
</span><a href="GHC.Core.html#Lit"><span class="hs-identifier hs-var">Lit</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; Literal
</span><a href="GHC.Types.Literal.html#mkLitString"><span class="hs-identifier hs-var">mkLitString</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681142685"><span class="hs-identifier hs-var">full_msg</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-408"></span><span>        </span><span class="hs-comment">-- mkLitString returns a result of type String#</span><span>
</span><span id="line-409"></span><span>    </span><span class="annot"><span class="annottext">CoreExpr -&gt; DsM CoreExpr
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CoreExpr -&gt; [CoreExpr] -&gt; CoreExpr
forall b. Expr b -&gt; [Expr b] -&gt; Expr b
</span><a href="GHC.Core.html#mkApps"><span class="hs-identifier hs-var">mkApps</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; CoreExpr
forall b. Id -&gt; Expr b
</span><a href="GHC.Core.html#Var"><span class="hs-identifier hs-var">Var</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142692"><span class="hs-identifier hs-var">err_id</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Mult -&gt; CoreExpr
forall b. Mult -&gt; Expr b
</span><a href="GHC.Core.html#Type"><span class="hs-identifier hs-var">Type</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Mult -&gt; Mult
Mult -&gt; Mult
</span><a href="GHC.Core.Type.html#getRuntimeRep"><span class="hs-identifier hs-var">getRuntimeRep</span></a></span><span> </span><span class="annot"><span class="annottext">Mult
</span><a href="#local-6989586621681142691"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Mult -&gt; CoreExpr
forall b. Mult -&gt; Expr b
</span><a href="GHC.Core.html#Type"><span class="hs-identifier hs-var">Type</span></a></span><span> </span><span class="annot"><span class="annottext">Mult
</span><a href="#local-6989586621681142691"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142681"><span class="hs-identifier hs-var">core_msg</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-410"></span><span>
</span><span id="line-411"></span><span class="hs-comment">{-
'mkCoreAppDs' and 'mkCoreAppsDs' handle the special-case desugaring of 'seq'.

Note [Desugaring seq]
~~~~~~~~~~~~~~~~~~~~~

There are a few subtleties in the desugaring of `seq`:

 1. (as described in #1031)

    Consider,
       f x y = x `seq` (y `seq` (# x,y #))

    The [Core let/app invariant] means that, other things being equal, because
    the argument to the outer 'seq' has an unlifted type, we'll use call-by-value thus:

       f x y = case (y `seq` (# x,y #)) of v -&gt; x `seq` v

    But that is bad for two reasons:
      (a) we now evaluate y before x, and
      (b) we can't bind v to an unboxed pair

    Seq is very, very special!  So we recognise it right here, and desugar to
            case x of _ -&gt; case y of _ -&gt; (# x,y #)

 2. (as described in #2273)

    Consider
       let chp = case b of { True -&gt; fst x; False -&gt; 0 }
       in chp `seq` ...chp...
    Here the seq is designed to plug the space leak of retaining (snd x)
    for too long.

    If we rely on the ordinary inlining of seq, we'll get
       let chp = case b of { True -&gt; fst x; False -&gt; 0 }
       case chp of _ { I# -&gt; ...chp... }

    But since chp is cheap, and the case is an alluring contet, we'll
    inline chp into the case scrutinee.  Now there is only one use of chp,
    so we'll inline a second copy.  Alas, we've now ruined the purpose of
    the seq, by re-introducing the space leak:
        case (case b of {True -&gt; fst x; False -&gt; 0}) of
          I# _ -&gt; ...case b of {True -&gt; fst x; False -&gt; 0}...

    We can try to avoid doing this by ensuring that the binder-swap in the
    case happens, so we get his at an early stage:
       case chp of chp2 { I# -&gt; ...chp2... }
    But this is fragile.  The real culprit is the source program.  Perhaps we
    should have said explicitly
       let !chp2 = chp in ...chp2...

    But that's painful.  So the code here does a little hack to make seq
    more robust: a saturated application of 'seq' is turned *directly* into
    the case expression, thus:
       x  `seq` e2 ==&gt; case x of x -&gt; e2    -- Note shadowing!
       e1 `seq` e2 ==&gt; case x of _ -&gt; e2

    So we desugar our example to:
       let chp = case b of { True -&gt; fst x; False -&gt; 0 }
       case chp of chp { I# -&gt; ...chp... }
    And now all is well.

    The reason it's a hack is because if you define mySeq=seq, the hack
    won't work on mySeq.

 3. (as described in #2409)

    The isLocalId ensures that we don't turn
            True `seq` e
    into
            case True of True { ... }
    which stupidly tries to bind the datacon 'True'.
-}</span><span>
</span><span id="line-484"></span><span>
</span><span id="line-485"></span><span class="hs-comment">-- NB: Make sure the argument is not levity polymorphic</span><span>
</span><span id="line-486"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkCoreAppDs"><span class="hs-identifier hs-type">mkCoreAppDs</span></a></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span>
</span><span id="line-487"></span><span id="mkCoreAppDs"><span class="annot"><span class="annottext">mkCoreAppDs :: SDoc -&gt; CoreExpr -&gt; CoreExpr -&gt; CoreExpr
</span><a href="GHC.HsToCore.Utils.html#mkCoreAppDs"><span class="hs-identifier hs-var hs-var">mkCoreAppDs</span></a></span></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span> </span><span id="local-6989586621681142676"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142676"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="annot"><a href="GHC.Core.html#App"><span class="hs-operator hs-type">`App`</span></a></span><span> </span><span class="annot"><a href="GHC.Core.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span id="local-6989586621681142674"><span class="annot"><span class="annottext">Mult
</span><a href="#local-6989586621681142674"><span class="hs-identifier hs-var">_r</span></a></span></span><span> </span><span class="annot"><a href="GHC.Core.html#App"><span class="hs-operator hs-type">`App`</span></a></span><span> </span><span class="annot"><a href="GHC.Core.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span id="local-6989586621681142673"><span class="annot"><span class="annottext">Mult
</span><a href="#local-6989586621681142673"><span class="hs-identifier hs-var">ty1</span></a></span></span><span> </span><span class="annot"><a href="GHC.Core.html#App"><span class="hs-operator hs-type">`App`</span></a></span><span> </span><span class="annot"><a href="GHC.Core.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span id="local-6989586621681142672"><span class="annot"><span class="annottext">Mult
</span><a href="#local-6989586621681142672"><span class="hs-identifier hs-var">ty2</span></a></span></span><span> </span><span class="annot"><a href="GHC.Core.html#App"><span class="hs-operator hs-type">`App`</span></a></span><span> </span><span id="local-6989586621681142671"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142671"><span class="hs-identifier hs-var">arg1</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681142670"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142670"><span class="hs-identifier hs-var">arg2</span></a></span></span><span>
</span><span id="line-488"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142676"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Id -&gt; Unique -&gt; Bool
forall a. Uniquable a =&gt; a -&gt; Unique -&gt; Bool
</span><a href="GHC.Types.Unique.html#hasKey"><span class="hs-operator hs-var">`hasKey`</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#seqIdKey"><span class="hs-identifier hs-var">seqIdKey</span></a></span><span>            </span><span class="hs-comment">-- Note [Desugaring seq], points (1) and (2)</span><span>
</span><span id="line-489"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoreExpr -&gt; Id -&gt; Mult -&gt; [Alt Id] -&gt; CoreExpr
forall b. Expr b -&gt; b -&gt; Mult -&gt; [Alt b] -&gt; Expr b
</span><a href="GHC.Core.html#Case"><span class="hs-identifier hs-var">Case</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142671"><span class="hs-identifier hs-var">arg1</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142667"><span class="hs-identifier hs-var">case_bndr</span></a></span><span> </span><span class="annot"><span class="annottext">Mult
</span><a href="#local-6989586621681142672"><span class="hs-identifier hs-var">ty2</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><span class="annottext">AltCon
</span><a href="GHC.Core.html#DEFAULT"><span class="hs-identifier hs-var">DEFAULT</span></a></span><span class="hs-special">,</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142670"><span class="hs-identifier hs-var">arg2</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-490"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-491"></span><span>    </span><span id="local-6989586621681142667"><span class="annot"><span class="annottext">case_bndr :: Id
</span><a href="#local-6989586621681142667"><span class="hs-identifier hs-var hs-var">case_bndr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142671"><span class="hs-identifier hs-var">arg1</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-492"></span><span>                   </span><span class="annot"><a href="GHC.Core.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span> </span><span id="local-6989586621681142666"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142666"><span class="hs-identifier hs-var">v1</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Bool
</span><a href="GHC.Types.Name.html#isInternalName"><span class="hs-identifier hs-var">isInternalName</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; Name
</span><a href="GHC.Types.Id.html#idName"><span class="hs-identifier hs-var">idName</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142666"><span class="hs-identifier hs-var">v1</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-493"></span><span>                          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142666"><span class="hs-identifier hs-var">v1</span></a></span><span>        </span><span class="hs-comment">-- Note [Desugaring seq], points (2) and (3)</span><span>
</span><span id="line-494"></span><span>                   </span><span class="annot"><span class="annottext">CoreExpr
</span><span class="hs-identifier">_</span></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Mult -&gt; Mult -&gt; Id
</span><a href="GHC.Core.Make.html#mkWildValBinder"><span class="hs-identifier hs-var">mkWildValBinder</span></a></span><span> </span><span class="annot"><span class="annottext">Mult
</span><a href="GHC.Core.Type.html#Many"><span class="hs-identifier hs-var">Many</span></a></span><span> </span><span class="annot"><span class="annottext">Mult
</span><a href="#local-6989586621681142673"><span class="hs-identifier hs-var">ty1</span></a></span><span>
</span><span id="line-495"></span><span>
</span><span id="line-496"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkCoreAppDs"><span class="hs-identifier hs-var">mkCoreAppDs</span></a></span><span> </span><span id="local-6989586621681142662"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681142662"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621681142661"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142661"><span class="hs-identifier hs-var">fun</span></a></span></span><span> </span><span id="local-6989586621681142660"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142660"><span class="hs-identifier hs-var">arg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; CoreExpr -&gt; CoreExpr -&gt; CoreExpr
</span><a href="GHC.Core.Make.html#mkCoreApp"><span class="hs-identifier hs-var">mkCoreApp</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681142662"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142661"><span class="hs-identifier hs-var">fun</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142660"><span class="hs-identifier hs-var">arg</span></a></span><span>  </span><span class="hs-comment">-- The rest is done in GHC.Core.Make</span><span>
</span><span id="line-497"></span><span>
</span><span id="line-498"></span><span class="hs-comment">-- NB: No argument can be levity polymorphic</span><span>
</span><span id="line-499"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkCoreAppsDs"><span class="hs-identifier hs-type">mkCoreAppsDs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span>
</span><span id="line-500"></span><span id="mkCoreAppsDs"><span class="annot"><span class="annottext">mkCoreAppsDs :: SDoc -&gt; CoreExpr -&gt; [CoreExpr] -&gt; CoreExpr
</span><a href="GHC.HsToCore.Utils.html#mkCoreAppsDs"><span class="hs-identifier hs-var hs-var">mkCoreAppsDs</span></a></span></span><span> </span><span id="local-6989586621681142658"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681142658"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621681142657"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142657"><span class="hs-identifier hs-var">fun</span></a></span></span><span> </span><span id="local-6989586621681142656"><span class="annot"><span class="annottext">[CoreExpr]
</span><a href="#local-6989586621681142656"><span class="hs-identifier hs-var">args</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(CoreExpr -&gt; CoreExpr -&gt; CoreExpr)
-&gt; CoreExpr -&gt; [CoreExpr] -&gt; CoreExpr
forall (t :: * -&gt; *) b a.
Foldable t =&gt;
(b -&gt; a -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldl%27"><span class="hs-identifier hs-var">foldl'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SDoc -&gt; CoreExpr -&gt; CoreExpr -&gt; CoreExpr
</span><a href="GHC.HsToCore.Utils.html#mkCoreAppDs"><span class="hs-identifier hs-var">mkCoreAppDs</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681142658"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142657"><span class="hs-identifier hs-var">fun</span></a></span><span> </span><span class="annot"><span class="annottext">[CoreExpr]
</span><a href="#local-6989586621681142656"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-501"></span><span>
</span><span id="line-502"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkCastDs"><span class="hs-identifier hs-type">mkCastDs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span>
</span><span id="line-503"></span><span class="hs-comment">-- We define a desugarer-specific version of GHC.Core.Utils.mkCast,</span><span>
</span><span id="line-504"></span><span class="hs-comment">-- because in the immediate output of the desugarer, we can have</span><span>
</span><span id="line-505"></span><span class="hs-comment">-- apparently-mis-matched coercions:  E.g.</span><span>
</span><span id="line-506"></span><span class="hs-comment">--     let a = b</span><span>
</span><span id="line-507"></span><span class="hs-comment">--     in (x :: a) |&gt; (co :: b ~ Int)</span><span>
</span><span id="line-508"></span><span class="hs-comment">-- Lint know about type-bindings for let and does not complain</span><span>
</span><span id="line-509"></span><span class="hs-comment">-- So here we do not make the assertion checks that we make in</span><span>
</span><span id="line-510"></span><span class="hs-comment">-- GHC.Core.Utils.mkCast; and we do less peephole optimisation too</span><span>
</span><span id="line-511"></span><span id="mkCastDs"><span class="annot"><span class="annottext">mkCastDs :: CoreExpr -&gt; Coercion -&gt; CoreExpr
</span><a href="GHC.HsToCore.Utils.html#mkCastDs"><span class="hs-identifier hs-var hs-var">mkCastDs</span></a></span></span><span> </span><span id="local-6989586621681142654"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142654"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span id="local-6989586621681142653"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621681142653"><span class="hs-identifier hs-var">co</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Bool
</span><a href="GHC.Core.Coercion.html#isReflCo"><span class="hs-identifier hs-var">isReflCo</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621681142653"><span class="hs-identifier hs-var">co</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142654"><span class="hs-identifier hs-var">e</span></a></span><span>
</span><span id="line-512"></span><span>              </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoreExpr -&gt; Coercion -&gt; CoreExpr
forall b. Expr b -&gt; Coercion -&gt; Expr b
</span><a href="GHC.Core.html#Cast"><span class="hs-identifier hs-var">Cast</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142654"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621681142653"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-513"></span><span>
</span><span id="line-514"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
               Tuples and selector bindings
*                                                                      *
************************************************************************

This is used in various places to do with lazy patterns.
For each binder $b$ in the pattern, we create a binding:
\begin{verbatim}
    b = case v of pat' -&gt; b'
\end{verbatim}
where @pat'@ is @pat@ with each binder @b@ cloned into @b'@.

ToDo: making these bindings should really depend on whether there's
much work to be done per binding.  If the pattern is complex, it
should be de-mangled once, into a tuple (and then selected from).
Otherwise the demangling can be in-line in the bindings (as here).

Boring!  Boring!  One error message per binder.  The above ToDo is
even more helpful.  Something very similar happens for pattern-bound
expressions.

Note [mkSelectorBinds]
~~~~~~~~~~~~~~~~~~~~~~
mkSelectorBinds is used to desugar a pattern binding {p = e},
in a binding group:
  let { ...; p = e; ... } in body
where p binds x,y (this list of binders can be empty).
There are two cases.

------ Special case (A) -------
  For a pattern that is just a variable,
     let !x = e in body
  ==&gt;
     let x = e in x `seq` body
  So we return the binding, with 'x' as the variable to seq.

------ Special case (B) -------
  For a pattern that is essentially just a tuple:
      * A product type, so cannot fail
      * Only one level, so that
          - generating multiple matches is fine
          - seq'ing it evaluates the same as matching it
  Then instead we generate
       { v = e
       ; x = case v of p -&gt; x
       ; y = case v of p -&gt; y }
  with 'v' as the variable to force

------ General case (C) -------
  In the general case we generate these bindings:
       let { ...; p = e; ... } in body
  ==&gt;
       let { t = case e of p -&gt; (x,y)
           ; x = case t of (x,y) -&gt; x
           ; y = case t of (x,y) -&gt; y }
       in t `seq` body

  Note that we return 't' as the variable to force if the pattern
  is strict (i.e. with -XStrict or an outermost-bang-pattern)

  Note that (A) /includes/ the situation where

   * The pattern binds exactly one variable
        let !(Just (Just x) = e in body
     ==&gt;
       let { t = case e of Just (Just v) -&gt; Solo v
           ; v = case t of Solo v -&gt; v }
       in t `seq` body
    The 'Solo' is a one-tuple; see Note [One-tuples] in GHC.Builtin.Types
    Note that forcing 't' makes the pattern match happen,
    but does not force 'v'.

  * The pattern binds no variables
        let !(True,False) = e in body
    ==&gt;
        let t = case e of (True,False) -&gt; ()
        in t `seq` body


------ Examples ----------
  *   !(_, (_, a)) = e
    ==&gt;
      t = case e of (_, (_, a)) -&gt; Solo a
      a = case t of Solo a -&gt; a

    Note that
     - Forcing 't' will force the pattern to match fully;
       e.g. will diverge if (snd e) is bottom
     - But 'a' itself is not forced; it is wrapped in a one-tuple
       (see Note [One-tuples] in GHC.Builtin.Types)

  *   !(Just x) = e
    ==&gt;
      t = case e of Just x -&gt; Solo x
      x = case t of Solo x -&gt; x

    Again, forcing 't' will fail if 'e' yields Nothing.

Note that even though this is rather general, the special cases
work out well:

* One binder, not -XStrict:

    let Just (Just v) = e in body
  ==&gt;
    let t = case e of Just (Just v) -&gt; Solo v
        v = case t of Solo v -&gt; v
    in body
  ==&gt;
    let v = case (case e of Just (Just v) -&gt; Solo v) of
              Solo v -&gt; v
    in body
  ==&gt;
    let v = case e of Just (Just v) -&gt; v
    in body

* Non-recursive, -XStrict
     let p = e in body
  ==&gt;
     let { t = case e of p -&gt; (x,y)
         ; x = case t of (x,y) -&gt; x
         ; y = case t of (x,y) -&gt; x }
     in t `seq` body
  ==&gt; {inline seq, float x,y bindings inwards}
     let t = case e of p -&gt; (x,y) in
     case t of t' -&gt;
     let { x = case t' of (x,y) -&gt; x
         ; y = case t' of (x,y) -&gt; x } in
     body
  ==&gt; {inline t, do case of case}
     case e of p -&gt;
     let t = (x,y) in
     let { x = case t' of (x,y) -&gt; x
         ; y = case t' of (x,y) -&gt; x } in
     body
  ==&gt; {case-cancellation, drop dead code}
     case e of p -&gt; body

* Special case (B) is there to avoid fruitlessly taking the tuple
  apart and rebuilding it. For example, consider
     { K x y = e }
  where K is a product constructor.  Then general case (A) does:
     { t = case e of K x y -&gt; (x,y)
     ; x = case t of (x,y) -&gt; x
     ; y = case t of (x,y) -&gt; y }
  In the lazy case we can't optimise out this fruitless taking apart
  and rebuilding.  Instead (B) builds
     { v = e
     ; x = case v of K x y -&gt; x
     ; y = case v of K x y -&gt; y }
  which is better.
-}</span><span>
</span><span id="line-668"></span><span class="hs-comment">-- Remark: pattern selectors only occur in unrestricted patterns so we are free</span><span>
</span><span id="line-669"></span><span class="hs-comment">-- to select Many as the multiplicity of every let-expression introduced.</span><span>
</span><span id="line-670"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkSelectorBinds"><span class="hs-identifier hs-type">mkSelectorBinds</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.html#Tickish"><span class="hs-identifier hs-type">Tickish</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">]</span><span class="hs-special">]</span><span> </span><span class="hs-comment">-- ^ ticks to add, possibly</span><span>
</span><span id="line-671"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span>     </span><span class="hs-comment">-- ^ The pattern</span><span>
</span><span id="line-672"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span>       </span><span class="hs-comment">-- ^ Expression to which the pattern is bound</span><span>
</span><span id="line-673"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">,</span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">,</span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-674"></span><span>                </span><span class="hs-comment">-- ^ Id the rhs is bound to, for desugaring strict</span><span>
</span><span id="line-675"></span><span>                </span><span class="hs-comment">-- binds (see Note [Desugar Strict binds] in &quot;GHC.HsToCore.Binds&quot;)</span><span>
</span><span id="line-676"></span><span>                </span><span class="hs-comment">-- and all the desugared binds</span><span>
</span><span id="line-677"></span><span>
</span><span id="line-678"></span><span id="mkSelectorBinds"><span class="annot"><span class="annottext">mkSelectorBinds :: [[Tickish Id]]
-&gt; XRec (GhcPass 'Typechecked) Pat
-&gt; CoreExpr
-&gt; DsM (Id, [(Id, CoreExpr)])
</span><a href="GHC.HsToCore.Utils.html#mkSelectorBinds"><span class="hs-identifier hs-var hs-var">mkSelectorBinds</span></a></span></span><span> </span><span id="local-6989586621681142650"><span class="annot"><span class="annottext">[[Tickish Id]]
</span><a href="#local-6989586621681142650"><span class="hs-identifier hs-var">ticks</span></a></span></span><span> </span><span id="local-6989586621681142649"><span class="annot"><span class="annottext">XRec (GhcPass 'Typechecked) Pat
</span><a href="#local-6989586621681142649"><span class="hs-identifier hs-var">pat</span></a></span></span><span> </span><span id="local-6989586621681142648"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142648"><span class="hs-identifier hs-var">val_expr</span></a></span></span><span>
</span><span id="line-679"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#VarPat"><span class="hs-identifier hs-type">VarPat</span></a></span><span> </span><span class="annot"><span class="annottext">XVarPat (GhcPass 'Typechecked)
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681142646"><span class="annot"><span class="annottext">IdP (GhcPass 'Typechecked)
</span><a href="#local-6989586621681142646"><span class="hs-identifier hs-var">v</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">XRec (GhcPass 'Typechecked) Pat
</span><a href="#local-6989586621681142645"><span class="hs-identifier hs-var">pat'</span></a></span><span>     </span><span class="hs-comment">-- Special case (A)</span><span>
</span><span id="line-680"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Id, [(Id, CoreExpr)]) -&gt; DsM (Id, [(Id, CoreExpr)])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id
IdP (GhcPass 'Typechecked)
</span><a href="#local-6989586621681142646"><span class="hs-identifier hs-var">v</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id
IdP (GhcPass 'Typechecked)
</span><a href="#local-6989586621681142646"><span class="hs-identifier hs-var">v</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142648"><span class="hs-identifier hs-var">val_expr</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-681"></span><span>
</span><span id="line-682"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">XRec (GhcPass 'Typechecked) Pat -&gt; Bool
</span><a href="GHC.HsToCore.Utils.html#is_flat_prod_lpat"><span class="hs-identifier hs-var">is_flat_prod_lpat</span></a></span><span> </span><span class="annot"><span class="annottext">XRec (GhcPass 'Typechecked) Pat
</span><a href="#local-6989586621681142645"><span class="hs-identifier hs-var">pat'</span></a></span><span>           </span><span class="hs-comment">-- Special case (B)</span><span>
</span><span id="line-683"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681142643"><span class="annot"><span class="annottext">pat_ty :: Mult
</span><a href="#local-6989586621681142643"><span class="hs-identifier hs-var hs-var">pat_ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">XRec (GhcPass 'Typechecked) Pat -&gt; Mult
</span><a href="GHC.Tc.Utils.Zonk.html#hsLPatType"><span class="hs-identifier hs-var">hsLPatType</span></a></span><span> </span><span class="annot"><span class="annottext">XRec (GhcPass 'Typechecked) Pat
</span><a href="#local-6989586621681142645"><span class="hs-identifier hs-var">pat'</span></a></span><span>
</span><span id="line-684"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681142641"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142641"><span class="hs-identifier hs-var">val_var</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Mult -&gt; Mult -&gt; DsM Id
</span><a href="GHC.HsToCore.Monad.html#newSysLocalDsNoLP"><span class="hs-identifier hs-var">newSysLocalDsNoLP</span></a></span><span> </span><span class="annot"><span class="annottext">Mult
</span><a href="GHC.Core.Type.html#Many"><span class="hs-identifier hs-var">Many</span></a></span><span> </span><span class="annot"><span class="annottext">Mult
</span><a href="#local-6989586621681142643"><span class="hs-identifier hs-var">pat_ty</span></a></span><span>
</span><span id="line-685"></span><span>
</span><span id="line-686"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681142640"><span class="annot"><span class="annottext">mk_bind :: [Tickish Id] -&gt; Id -&gt; IOEnv (Env DsGblEnv DsLclEnv) (Id, CoreExpr)
</span><a href="#local-6989586621681142640"><span class="hs-identifier hs-var hs-var">mk_bind</span></a></span></span><span> </span><span id="local-6989586621681142639"><span class="annot"><span class="annottext">[Tickish Id]
</span><a href="#local-6989586621681142639"><span class="hs-identifier hs-var">tick</span></a></span></span><span> </span><span id="local-6989586621681142638"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142638"><span class="hs-identifier hs-var">bndr_var</span></a></span></span><span>
</span><span id="line-687"></span><span>               </span><span class="hs-comment">-- (mk_bind sv bv)  generates  bv = case sv of { pat -&gt; bv }</span><span>
</span><span id="line-688"></span><span>               </span><span class="hs-comment">-- Remember, 'pat' binds 'bv'</span><span>
</span><span id="line-689"></span><span>               </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681142637"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142637"><span class="hs-identifier hs-var">rhs_expr</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CoreExpr
-&gt; HsMatchContext GhcRn
-&gt; XRec (GhcPass 'Typechecked) Pat
-&gt; CoreExpr
-&gt; CoreExpr
-&gt; DsM CoreExpr
</span><a href="GHC.HsToCore.Match.html#matchSimply"><span class="hs-identifier hs-var">matchSimply</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; CoreExpr
forall b. Id -&gt; Expr b
</span><a href="GHC.Core.html#Var"><span class="hs-identifier hs-var">Var</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142641"><span class="hs-identifier hs-var">val_var</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">HsMatchContext GhcRn
forall p. HsMatchContext p
</span><a href="GHC.Hs.Expr.html#PatBindRhs"><span class="hs-identifier hs-var">PatBindRhs</span></a></span><span> </span><span class="annot"><span class="annottext">XRec (GhcPass 'Typechecked) Pat
</span><a href="#local-6989586621681142645"><span class="hs-identifier hs-var">pat'</span></a></span><span>
</span><span id="line-690"></span><span>                                       </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; CoreExpr
forall b. Id -&gt; Expr b
</span><a href="GHC.Core.html#Var"><span class="hs-identifier hs-var">Var</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142638"><span class="hs-identifier hs-var">bndr_var</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-691"></span><span>                                       </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; CoreExpr
forall b. Id -&gt; Expr b
</span><a href="GHC.Core.html#Var"><span class="hs-identifier hs-var">Var</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142638"><span class="hs-identifier hs-var">bndr_var</span></a></span><span class="hs-special">)</span><span>  </span><span class="hs-comment">-- Neat hack</span><span>
</span><span id="line-692"></span><span>                      </span><span class="hs-comment">-- Neat hack: since 'pat' can't fail, the</span><span>
</span><span id="line-693"></span><span>                      </span><span class="hs-comment">-- &quot;fail-expr&quot; passed to matchSimply is not</span><span>
</span><span id="line-694"></span><span>                      </span><span class="hs-comment">-- used. But it /is/ used for its type, and for</span><span>
</span><span id="line-695"></span><span>                      </span><span class="hs-comment">-- that bndr_var is just the ticket.</span><span>
</span><span id="line-696"></span><span>                    </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(Id, CoreExpr) -&gt; IOEnv (Env DsGblEnv DsLclEnv) (Id, CoreExpr)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142638"><span class="hs-identifier hs-var">bndr_var</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Tickish Id] -&gt; CoreExpr -&gt; CoreExpr
</span><a href="GHC.HsToCore.Utils.html#mkOptTickBox"><span class="hs-identifier hs-var">mkOptTickBox</span></a></span><span> </span><span class="annot"><span class="annottext">[Tickish Id]
</span><a href="#local-6989586621681142639"><span class="hs-identifier hs-var">tick</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142637"><span class="hs-identifier hs-var">rhs_expr</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-697"></span><span>
</span><span id="line-698"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681142635"><span class="annot"><span class="annottext">[(Id, CoreExpr)]
</span><a href="#local-6989586621681142635"><span class="hs-identifier hs-var">binds</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">([Tickish Id]
 -&gt; Id -&gt; IOEnv (Env DsGblEnv DsLclEnv) (Id, CoreExpr))
-&gt; [[Tickish Id]]
-&gt; [Id]
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [(Id, CoreExpr)]
forall (m :: * -&gt; *) a b c.
Applicative m =&gt;
(a -&gt; b -&gt; m c) -&gt; [a] -&gt; [b] -&gt; m [c]
</span><a href="../../base/src/Control.Monad.html#zipWithM"><span class="hs-identifier hs-var">zipWithM</span></a></span><span> </span><span class="annot"><span class="annottext">[Tickish Id] -&gt; Id -&gt; IOEnv (Env DsGblEnv DsLclEnv) (Id, CoreExpr)
</span><a href="#local-6989586621681142640"><span class="hs-identifier hs-var">mk_bind</span></a></span><span> </span><span class="annot"><span class="annottext">[[Tickish Id]]
</span><a href="#local-6989586621681142634"><span class="hs-identifier hs-var">ticks'</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
[IdP (GhcPass 'Typechecked)]
</span><a href="#local-6989586621681142633"><span class="hs-identifier hs-var">binders</span></a></span><span>
</span><span id="line-699"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(Id, [(Id, CoreExpr)]) -&gt; DsM (Id, [(Id, CoreExpr)])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142641"><span class="hs-identifier hs-var">val_var</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142641"><span class="hs-identifier hs-var">val_var</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142648"><span class="hs-identifier hs-var">val_expr</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(Id, CoreExpr) -&gt; [(Id, CoreExpr)] -&gt; [(Id, CoreExpr)]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[(Id, CoreExpr)]
</span><a href="#local-6989586621681142635"><span class="hs-identifier hs-var">binds</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-700"></span><span>
</span><span id="line-701"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                          </span><span class="hs-comment">-- General case (C)</span><span>
</span><span id="line-702"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681142632"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142632"><span class="hs-identifier hs-var">tuple_var</span></a></span></span><span>  </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Mult -&gt; Mult -&gt; DsM Id
</span><a href="GHC.HsToCore.Monad.html#newSysLocalDs"><span class="hs-identifier hs-var">newSysLocalDs</span></a></span><span> </span><span class="annot"><span class="annottext">Mult
</span><a href="GHC.Core.Type.html#Many"><span class="hs-identifier hs-var">Many</span></a></span><span> </span><span class="annot"><span class="annottext">Mult
</span><a href="#local-6989586621681142630"><span class="hs-identifier hs-var">tuple_ty</span></a></span><span>
</span><span id="line-703"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681142629"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142629"><span class="hs-identifier hs-var">error_expr</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Id -&gt; Mult -&gt; SDoc -&gt; DsM CoreExpr
</span><a href="GHC.HsToCore.Utils.html#mkErrorAppDs"><span class="hs-identifier hs-var">mkErrorAppDs</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="GHC.Core.Make.html#pAT_ERROR_ID"><span class="hs-identifier hs-var">pAT_ERROR_ID</span></a></span><span> </span><span class="annot"><span class="annottext">Mult
</span><a href="#local-6989586621681142630"><span class="hs-identifier hs-var">tuple_ty</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenLocated SrcSpan (Pat (GhcPass 'Typechecked)) -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan (Pat (GhcPass 'Typechecked))
XRec (GhcPass 'Typechecked) Pat
</span><a href="#local-6989586621681142645"><span class="hs-identifier hs-var">pat'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-704"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681142627"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142627"><span class="hs-identifier hs-var">tuple_expr</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CoreExpr
-&gt; HsMatchContext GhcRn
-&gt; XRec (GhcPass 'Typechecked) Pat
-&gt; CoreExpr
-&gt; CoreExpr
-&gt; DsM CoreExpr
</span><a href="GHC.HsToCore.Match.html#matchSimply"><span class="hs-identifier hs-var">matchSimply</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142648"><span class="hs-identifier hs-var">val_expr</span></a></span><span> </span><span class="annot"><span class="annottext">HsMatchContext GhcRn
forall p. HsMatchContext p
</span><a href="GHC.Hs.Expr.html#PatBindRhs"><span class="hs-identifier hs-var">PatBindRhs</span></a></span><span> </span><span class="annot"><span class="annottext">XRec (GhcPass 'Typechecked) Pat
</span><a href="#local-6989586621681142649"><span class="hs-identifier hs-var">pat</span></a></span><span>
</span><span id="line-705"></span><span>                                   </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142626"><span class="hs-identifier hs-var">local_tuple</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142629"><span class="hs-identifier hs-var">error_expr</span></a></span><span>
</span><span id="line-706"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681142625"><span class="annot"><span class="annottext">mk_tup_bind :: [Tickish Id] -&gt; Id -&gt; (Id, CoreExpr)
</span><a href="#local-6989586621681142625"><span class="hs-identifier hs-var hs-var">mk_tup_bind</span></a></span></span><span> </span><span id="local-6989586621681142624"><span class="annot"><span class="annottext">[Tickish Id]
</span><a href="#local-6989586621681142624"><span class="hs-identifier hs-var">tick</span></a></span></span><span> </span><span id="local-6989586621681142623"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142623"><span class="hs-identifier hs-var">binder</span></a></span></span><span>
</span><span id="line-707"></span><span>               </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142623"><span class="hs-identifier hs-var">binder</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Tickish Id] -&gt; CoreExpr -&gt; CoreExpr
</span><a href="GHC.HsToCore.Utils.html#mkOptTickBox"><span class="hs-identifier hs-var">mkOptTickBox</span></a></span><span> </span><span class="annot"><span class="annottext">[Tickish Id]
</span><a href="#local-6989586621681142624"><span class="hs-identifier hs-var">tick</span></a></span><span> </span><span class="annot"><span class="annottext">(CoreExpr -&gt; CoreExpr) -&gt; CoreExpr -&gt; CoreExpr
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-708"></span><span>                          </span><span class="annot"><span class="annottext">[Id] -&gt; Id -&gt; Id -&gt; CoreExpr -&gt; CoreExpr
</span><a href="GHC.Core.Make.html#mkTupleSelector1"><span class="hs-identifier hs-var">mkTupleSelector1</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681142621"><span class="hs-identifier hs-var">local_binders</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142623"><span class="hs-identifier hs-var">binder</span></a></span><span>
</span><span id="line-709"></span><span>                                           </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142632"><span class="hs-identifier hs-var">tuple_var</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; CoreExpr
forall b. Id -&gt; Expr b
</span><a href="GHC.Core.html#Var"><span class="hs-identifier hs-var">Var</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142632"><span class="hs-identifier hs-var">tuple_var</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-710"></span><span>             </span><span id="local-6989586621681142620"><span class="annot"><span class="annottext">tup_binds :: [(Id, CoreExpr)]
</span><a href="#local-6989586621681142620"><span class="hs-identifier hs-var hs-var">tup_binds</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">([Tickish Id] -&gt; Id -&gt; (Id, CoreExpr))
-&gt; [[Tickish Id]] -&gt; [Id] -&gt; [(Id, CoreExpr)]
forall a b c. (a -&gt; b -&gt; c) -&gt; [a] -&gt; [b] -&gt; [c]
</span><a href="../../base/src/GHC.List.html#zipWith"><span class="hs-identifier hs-var">zipWith</span></a></span><span> </span><span class="annot"><span class="annottext">[Tickish Id] -&gt; Id -&gt; (Id, CoreExpr)
</span><a href="#local-6989586621681142625"><span class="hs-identifier hs-var">mk_tup_bind</span></a></span><span> </span><span class="annot"><span class="annottext">[[Tickish Id]]
</span><a href="#local-6989586621681142634"><span class="hs-identifier hs-var">ticks'</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
[IdP (GhcPass 'Typechecked)]
</span><a href="#local-6989586621681142633"><span class="hs-identifier hs-var">binders</span></a></span><span>
</span><span id="line-711"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(Id, [(Id, CoreExpr)]) -&gt; DsM (Id, [(Id, CoreExpr)])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142632"><span class="hs-identifier hs-var">tuple_var</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142632"><span class="hs-identifier hs-var">tuple_var</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142627"><span class="hs-identifier hs-var">tuple_expr</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(Id, CoreExpr) -&gt; [(Id, CoreExpr)] -&gt; [(Id, CoreExpr)]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[(Id, CoreExpr)]
</span><a href="#local-6989586621681142620"><span class="hs-identifier hs-var">tup_binds</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-712"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-713"></span><span>    </span><span id="local-6989586621681142645"><span class="annot"><span class="annottext">pat' :: XRec (GhcPass 'Typechecked) Pat
</span><a href="#local-6989586621681142645"><span class="hs-identifier hs-var hs-var">pat'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">XRec (GhcPass 'Typechecked) Pat -&gt; XRec (GhcPass 'Typechecked) Pat
forall (p :: Pass). LPat (GhcPass p) -&gt; LPat (GhcPass p)
</span><a href="GHC.HsToCore.Utils.html#strip_bangs"><span class="hs-identifier hs-var">strip_bangs</span></a></span><span> </span><span class="annot"><span class="annottext">XRec (GhcPass 'Typechecked) Pat
</span><a href="#local-6989586621681142649"><span class="hs-identifier hs-var">pat</span></a></span><span>
</span><span id="line-714"></span><span>           </span><span class="hs-comment">-- Strip the bangs before looking for case (A) or (B)</span><span>
</span><span id="line-715"></span><span>           </span><span class="hs-comment">-- The incoming pattern may well have a bang on it</span><span>
</span><span id="line-716"></span><span>
</span><span id="line-717"></span><span>    </span><span id="local-6989586621681142633"><span class="annot"><span class="annottext">binders :: [IdP (GhcPass 'Typechecked)]
</span><a href="#local-6989586621681142633"><span class="hs-identifier hs-var hs-var">binders</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">XRec (GhcPass 'Typechecked) Pat -&gt; [IdP (GhcPass 'Typechecked)]
forall p. CollectPass p =&gt; LPat p -&gt; [IdP p]
</span><a href="GHC.Hs.Utils.html#collectPatBinders"><span class="hs-identifier hs-var">collectPatBinders</span></a></span><span> </span><span class="annot"><span class="annottext">XRec (GhcPass 'Typechecked) Pat
</span><a href="#local-6989586621681142645"><span class="hs-identifier hs-var">pat'</span></a></span><span>
</span><span id="line-718"></span><span>    </span><span id="local-6989586621681142634"><span class="annot"><span class="annottext">ticks' :: [[Tickish Id]]
</span><a href="#local-6989586621681142634"><span class="hs-identifier hs-var hs-var">ticks'</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[[Tickish Id]]
</span><a href="#local-6989586621681142650"><span class="hs-identifier hs-var">ticks</span></a></span><span> </span><span class="annot"><span class="annottext">[[Tickish Id]] -&gt; [[Tickish Id]] -&gt; [[Tickish Id]]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[Tickish Id] -&gt; [[Tickish Id]]
forall a. a -&gt; [a]
</span><a href="../../base/src/GHC.List.html#repeat"><span class="hs-identifier hs-var">repeat</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-719"></span><span>
</span><span id="line-720"></span><span>    </span><span id="local-6989586621681142621"><span class="annot"><span class="annottext">local_binders :: [Id]
</span><a href="#local-6989586621681142621"><span class="hs-identifier hs-var hs-var">local_binders</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Id -&gt; Id) -&gt; [Id] -&gt; [Id]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Id -&gt; Id
</span><a href="GHC.Types.Id.html#localiseId"><span class="hs-identifier hs-var">localiseId</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
[IdP (GhcPass 'Typechecked)]
</span><a href="#local-6989586621681142633"><span class="hs-identifier hs-var">binders</span></a></span><span>      </span><span class="hs-comment">-- See Note [Localise pattern binders]</span><span>
</span><span id="line-721"></span><span>    </span><span id="local-6989586621681142626"><span class="annot"><span class="annottext">local_tuple :: CoreExpr
</span><a href="#local-6989586621681142626"><span class="hs-identifier hs-var hs-var">local_tuple</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Id] -&gt; CoreExpr
</span><a href="GHC.Core.Make.html#mkBigCoreVarTup1"><span class="hs-identifier hs-var">mkBigCoreVarTup1</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
[IdP (GhcPass 'Typechecked)]
</span><a href="#local-6989586621681142633"><span class="hs-identifier hs-var">binders</span></a></span><span>
</span><span id="line-722"></span><span>    </span><span id="local-6989586621681142630"><span class="annot"><span class="annottext">tuple_ty :: Mult
</span><a href="#local-6989586621681142630"><span class="hs-identifier hs-var hs-var">tuple_ty</span></a></span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoreExpr -&gt; Mult
</span><a href="GHC.Core.Utils.html#exprType"><span class="hs-identifier hs-var">exprType</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142626"><span class="hs-identifier hs-var">local_tuple</span></a></span><span>
</span><span id="line-723"></span><span>
</span><span id="line-724"></span><span id="local-6989586621681143117"><span class="annot"><a href="GHC.HsToCore.Utils.html#strip_bangs"><span class="hs-identifier hs-type">strip_bangs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPass"><span class="hs-identifier hs-type">GhcPass</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681143117"><span class="hs-identifier hs-type">p</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPass"><span class="hs-identifier hs-type">GhcPass</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681143117"><span class="hs-identifier hs-type">p</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-725"></span><span class="hs-comment">-- Remove outermost bangs and parens</span><span>
</span><span id="line-726"></span><span id="strip_bangs"><span class="annot"><span class="annottext">strip_bangs :: forall (p :: Pass). LPat (GhcPass p) -&gt; LPat (GhcPass p)
</span><a href="GHC.HsToCore.Utils.html#strip_bangs"><span class="hs-identifier hs-var hs-var">strip_bangs</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#ParPat"><span class="hs-identifier hs-type">ParPat</span></a></span><span> </span><span class="annot"><span class="annottext">XParPat (GhcPass p)
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681142613"><span class="annot"><span class="annottext">LPat (GhcPass p)
</span><a href="#local-6989586621681142613"><span class="hs-identifier hs-var">p</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LPat (GhcPass p) -&gt; LPat (GhcPass p)
forall (p :: Pass). LPat (GhcPass p) -&gt; LPat (GhcPass p)
</span><a href="GHC.HsToCore.Utils.html#strip_bangs"><span class="hs-identifier hs-var">strip_bangs</span></a></span><span> </span><span class="annot"><span class="annottext">LPat (GhcPass p)
</span><a href="#local-6989586621681142613"><span class="hs-identifier hs-var">p</span></a></span><span>
</span><span id="line-727"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#strip_bangs"><span class="hs-identifier hs-var">strip_bangs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#BangPat"><span class="hs-identifier hs-type">BangPat</span></a></span><span> </span><span class="annot"><span class="annottext">XBangPat (GhcPass p)
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681142612"><span class="annot"><span class="annottext">LPat (GhcPass p)
</span><a href="#local-6989586621681142612"><span class="hs-identifier hs-var">p</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LPat (GhcPass p) -&gt; LPat (GhcPass p)
forall (p :: Pass). LPat (GhcPass p) -&gt; LPat (GhcPass p)
</span><a href="GHC.HsToCore.Utils.html#strip_bangs"><span class="hs-identifier hs-var">strip_bangs</span></a></span><span> </span><span class="annot"><span class="annottext">LPat (GhcPass p)
</span><a href="#local-6989586621681142612"><span class="hs-identifier hs-var">p</span></a></span><span>
</span><span id="line-728"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#strip_bangs"><span class="hs-identifier hs-var">strip_bangs</span></a></span><span> </span><span id="local-6989586621681142611"><span class="annot"><span class="annottext">LPat (GhcPass p)
</span><a href="#local-6989586621681142611"><span class="hs-identifier hs-var">lp</span></a></span></span><span>                  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LPat (GhcPass p)
</span><a href="#local-6989586621681142611"><span class="hs-identifier hs-var">lp</span></a></span><span>
</span><span id="line-729"></span><span>
</span><span id="line-730"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#is_flat_prod_lpat"><span class="hs-identifier hs-type">is_flat_prod_lpat</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-731"></span><span id="is_flat_prod_lpat"><span class="annot"><span class="annottext">is_flat_prod_lpat :: XRec (GhcPass 'Typechecked) Pat -&gt; Bool
</span><a href="GHC.HsToCore.Utils.html#is_flat_prod_lpat"><span class="hs-identifier hs-var hs-var">is_flat_prod_lpat</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Pat (GhcPass 'Typechecked) -&gt; Bool
</span><a href="GHC.HsToCore.Utils.html#is_flat_prod_pat"><span class="hs-identifier hs-var">is_flat_prod_pat</span></a></span><span> </span><span class="annot"><span class="annottext">(Pat (GhcPass 'Typechecked) -&gt; Bool)
-&gt; (GenLocated SrcSpan (Pat (GhcPass 'Typechecked))
    -&gt; Pat (GhcPass 'Typechecked))
-&gt; GenLocated SrcSpan (Pat (GhcPass 'Typechecked))
-&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan (Pat (GhcPass 'Typechecked))
-&gt; Pat (GhcPass 'Typechecked)
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span>
</span><span id="line-732"></span><span>
</span><span id="line-733"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#is_flat_prod_pat"><span class="hs-identifier hs-type">is_flat_prod_pat</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#Pat"><span class="hs-identifier hs-type">Pat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-734"></span><span id="is_flat_prod_pat"><span class="annot"><span class="annottext">is_flat_prod_pat :: Pat (GhcPass 'Typechecked) -&gt; Bool
</span><a href="GHC.HsToCore.Utils.html#is_flat_prod_pat"><span class="hs-identifier hs-var hs-var">is_flat_prod_pat</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#ParPat"><span class="hs-identifier hs-type">ParPat</span></a></span><span> </span><span class="annot"><span class="annottext">XParPat (GhcPass 'Typechecked)
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681142609"><span class="annot"><span class="annottext">XRec (GhcPass 'Typechecked) Pat
</span><a href="#local-6989586621681142609"><span class="hs-identifier hs-var">p</span></a></span></span><span class="hs-special">)</span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">XRec (GhcPass 'Typechecked) Pat -&gt; Bool
</span><a href="GHC.HsToCore.Utils.html#is_flat_prod_lpat"><span class="hs-identifier hs-var">is_flat_prod_lpat</span></a></span><span> </span><span class="annot"><span class="annottext">XRec (GhcPass 'Typechecked) Pat
</span><a href="#local-6989586621681142609"><span class="hs-identifier hs-var">p</span></a></span><span>
</span><span id="line-735"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#is_flat_prod_pat"><span class="hs-identifier hs-var">is_flat_prod_pat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#TuplePat"><span class="hs-identifier hs-type">TuplePat</span></a></span><span> </span><span class="annot"><span class="annottext">XTuplePat (GhcPass 'Typechecked)
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681142607"><span class="annot"><span class="annottext">[XRec (GhcPass 'Typechecked) Pat]
</span><a href="#local-6989586621681142607"><span class="hs-identifier hs-var">ps</span></a></span></span><span> </span><span class="annot"><span class="annottext">Boxity
</span><a href="GHC.Types.Basic.html#Boxed"><span class="hs-identifier hs-var">Boxed</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(GenLocated SrcSpan (Pat (GhcPass 'Typechecked)) -&gt; Bool)
-&gt; [GenLocated SrcSpan (Pat (GhcPass 'Typechecked))] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#all"><span class="hs-identifier hs-var">all</span></a></span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan (Pat (GhcPass 'Typechecked)) -&gt; Bool
forall (p :: Pass). LPat (GhcPass p) -&gt; Bool
</span><a href="GHC.HsToCore.Utils.html#is_triv_lpat"><span class="hs-identifier hs-var">is_triv_lpat</span></a></span><span> </span><span class="annot"><span class="annottext">[GenLocated SrcSpan (Pat (GhcPass 'Typechecked))]
[XRec (GhcPass 'Typechecked) Pat]
</span><a href="#local-6989586621681142607"><span class="hs-identifier hs-var">ps</span></a></span><span>
</span><span id="line-736"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#is_flat_prod_pat"><span class="hs-identifier hs-var">is_flat_prod_pat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#ConPat"><span class="hs-identifier hs-type">ConPat</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">pat_con :: forall p. Pat p -&gt; Located (ConLikeP p)
</span><a href="GHC.Hs.Pat.html#pat_con"><span class="hs-identifier hs-var">pat_con</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681142601"><span class="annot"><span class="annottext">ConLikeP (GhcPass 'Typechecked)
</span><a href="#local-6989586621681142601"><span class="hs-identifier hs-var">pcon</span></a></span></span><span>
</span><span id="line-737"></span><span>                         </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">pat_args :: forall p. Pat p -&gt; HsConPatDetails p
</span><a href="GHC.Hs.Pat.html#pat_args"><span class="hs-identifier hs-var">pat_args</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681142599"><span class="annot"><span class="annottext">HsConPatDetails (GhcPass 'Typechecked)
</span><a href="#local-6989586621681142599"><span class="hs-identifier hs-var">ps</span></a></span></span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-738"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Core.ConLike.html#RealDataCon"><span class="hs-identifier hs-type">RealDataCon</span></a></span><span> </span><span id="local-6989586621681142597"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681142597"><span class="hs-identifier hs-var">con</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ConLikeP (GhcPass 'Typechecked)
</span><a href="#local-6989586621681142601"><span class="hs-identifier hs-var">pcon</span></a></span><span>
</span><span id="line-739"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isProductTyCon"><span class="hs-identifier hs-var">isProductTyCon</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DataCon -&gt; TyCon
</span><a href="GHC.Core.DataCon.html#dataConTyCon"><span class="hs-identifier hs-var">dataConTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681142597"><span class="hs-identifier hs-var">con</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-740"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(GenLocated SrcSpan (Pat (GhcPass 'Typechecked)) -&gt; Bool)
-&gt; [GenLocated SrcSpan (Pat (GhcPass 'Typechecked))] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#all"><span class="hs-identifier hs-var">all</span></a></span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan (Pat (GhcPass 'Typechecked)) -&gt; Bool
forall (p :: Pass). LPat (GhcPass p) -&gt; Bool
</span><a href="GHC.HsToCore.Utils.html#is_triv_lpat"><span class="hs-identifier hs-var">is_triv_lpat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsConPatDetails (GhcPass 'Typechecked)
-&gt; [XRec (GhcPass 'Typechecked) Pat]
forall p. HsConPatDetails p -&gt; [LPat p]
</span><a href="GHC.Hs.Pat.html#hsConPatArgs"><span class="hs-identifier hs-var">hsConPatArgs</span></a></span><span> </span><span class="annot"><span class="annottext">HsConPatDetails (GhcPass 'Typechecked)
</span><a href="#local-6989586621681142599"><span class="hs-identifier hs-var">ps</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-741"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#is_flat_prod_pat"><span class="hs-identifier hs-var">is_flat_prod_pat</span></a></span><span> </span><span class="annot"><span class="annottext">Pat (GhcPass 'Typechecked)
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-742"></span><span>
</span><span id="line-743"></span><span id="local-6989586621681143108"><span class="annot"><a href="GHC.HsToCore.Utils.html#is_triv_lpat"><span class="hs-identifier hs-type">is_triv_lpat</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPass"><span class="hs-identifier hs-type">GhcPass</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681143108"><span class="hs-identifier hs-type">p</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span><span>
</span><span id="line-744"></span><span id="is_triv_lpat"><span class="annot"><span class="annottext">is_triv_lpat :: forall (p :: Pass). LPat (GhcPass p) -&gt; Bool
</span><a href="GHC.HsToCore.Utils.html#is_triv_lpat"><span class="hs-identifier hs-var hs-var">is_triv_lpat</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Pat (GhcPass p) -&gt; Bool
forall (p :: Pass). Pat (GhcPass p) -&gt; Bool
</span><a href="GHC.HsToCore.Utils.html#is_triv_pat"><span class="hs-identifier hs-var">is_triv_pat</span></a></span><span> </span><span class="annot"><span class="annottext">(Pat (GhcPass p) -&gt; Bool)
-&gt; (GenLocated SrcSpan (Pat (GhcPass p)) -&gt; Pat (GhcPass p))
-&gt; GenLocated SrcSpan (Pat (GhcPass p))
-&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan (Pat (GhcPass p)) -&gt; Pat (GhcPass p)
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span>
</span><span id="line-745"></span><span>
</span><span id="line-746"></span><span id="local-6989586621681143101"><span class="annot"><a href="GHC.HsToCore.Utils.html#is_triv_pat"><span class="hs-identifier hs-type">is_triv_pat</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#Pat"><span class="hs-identifier hs-type">Pat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPass"><span class="hs-identifier hs-type">GhcPass</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681143101"><span class="hs-identifier hs-type">p</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span><span>
</span><span id="line-747"></span><span id="is_triv_pat"><span class="annot"><span class="annottext">is_triv_pat :: forall (p :: Pass). Pat (GhcPass p) -&gt; Bool
</span><a href="GHC.HsToCore.Utils.html#is_triv_pat"><span class="hs-identifier hs-var hs-var">is_triv_pat</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#VarPat"><span class="hs-identifier hs-type">VarPat</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-748"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#is_triv_pat"><span class="hs-identifier hs-var">is_triv_pat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#WildPat"><span class="hs-identifier hs-type">WildPat</span></a></span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-749"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#is_triv_pat"><span class="hs-identifier hs-var">is_triv_pat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#ParPat"><span class="hs-identifier hs-type">ParPat</span></a></span><span> </span><span class="annot"><span class="annottext">XParPat (GhcPass p)
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681142592"><span class="annot"><span class="annottext">LPat (GhcPass p)
</span><a href="#local-6989586621681142592"><span class="hs-identifier hs-var">p</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LPat (GhcPass p) -&gt; Bool
forall (p :: Pass). LPat (GhcPass p) -&gt; Bool
</span><a href="GHC.HsToCore.Utils.html#is_triv_lpat"><span class="hs-identifier hs-var">is_triv_lpat</span></a></span><span> </span><span class="annot"><span class="annottext">LPat (GhcPass p)
</span><a href="#local-6989586621681142592"><span class="hs-identifier hs-var">p</span></a></span><span>
</span><span id="line-750"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#is_triv_pat"><span class="hs-identifier hs-var">is_triv_pat</span></a></span><span> </span><span class="annot"><span class="annottext">Pat (GhcPass p)
</span><span class="hs-identifier">_</span></span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-751"></span><span>
</span><span id="line-752"></span><span>
</span><span id="line-753"></span><span class="hs-comment">{- *********************************************************************
*                                                                      *
  Creating big tuples and their types for full Haskell expressions.
  They work over *Ids*, and create tuples replete with their types,
  which is whey they are not in GHC.Hs.Utils.
*                                                                      *
********************************************************************* -}</span><span>
</span><span id="line-760"></span><span>
</span><span id="line-761"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkLHsPatTup"><span class="hs-identifier hs-type">mkLHsPatTup</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span>
</span><span id="line-762"></span><span id="mkLHsPatTup"><span class="annot"><span class="annottext">mkLHsPatTup :: [XRec (GhcPass 'Typechecked) Pat]
-&gt; XRec (GhcPass 'Typechecked) Pat
</span><a href="GHC.HsToCore.Utils.html#mkLHsPatTup"><span class="hs-identifier hs-var hs-var">mkLHsPatTup</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Pat (GhcPass 'Typechecked)
-&gt; GenLocated SrcSpan (Pat (GhcPass 'Typechecked))
forall e. e -&gt; Located e
</span><a href="GHC.Types.SrcLoc.html#noLoc"><span class="hs-identifier hs-var">noLoc</span></a></span><span> </span><span class="annot"><span class="annottext">(Pat (GhcPass 'Typechecked)
 -&gt; GenLocated SrcSpan (Pat (GhcPass 'Typechecked)))
-&gt; Pat (GhcPass 'Typechecked)
-&gt; GenLocated SrcSpan (Pat (GhcPass 'Typechecked))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[XRec (GhcPass 'Typechecked) Pat]
-&gt; Boxity -&gt; Pat (GhcPass 'Typechecked)
</span><a href="GHC.HsToCore.Utils.html#mkVanillaTuplePat"><span class="hs-identifier hs-var">mkVanillaTuplePat</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">Boxity
</span><a href="GHC.Types.Basic.html#Boxed"><span class="hs-identifier hs-var">Boxed</span></a></span><span>
</span><span id="line-763"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkLHsPatTup"><span class="hs-identifier hs-var">mkLHsPatTup</span></a></span><span> </span><span class="hs-special">[</span><span id="local-6989586621681142590"><span class="annot"><span class="annottext">XRec (GhcPass 'Typechecked) Pat
</span><a href="#local-6989586621681142590"><span class="hs-identifier hs-var">lpat</span></a></span></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">XRec (GhcPass 'Typechecked) Pat
</span><a href="#local-6989586621681142590"><span class="hs-identifier hs-var">lpat</span></a></span><span>
</span><span id="line-764"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkLHsPatTup"><span class="hs-identifier hs-var">mkLHsPatTup</span></a></span><span> </span><span id="local-6989586621681142589"><span class="annot"><span class="annottext">[XRec (GhcPass 'Typechecked) Pat]
</span><a href="#local-6989586621681142589"><span class="hs-identifier hs-var">lpats</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SrcSpan
-&gt; Pat (GhcPass 'Typechecked)
-&gt; GenLocated SrcSpan (Pat (GhcPass 'Typechecked))
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenLocated SrcSpan (Pat (GhcPass 'Typechecked)) -&gt; SrcSpan
forall l e. GenLocated l e -&gt; l
</span><a href="GHC.Types.SrcLoc.html#getLoc"><span class="hs-identifier hs-var">getLoc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[GenLocated SrcSpan (Pat (GhcPass 'Typechecked))]
-&gt; GenLocated SrcSpan (Pat (GhcPass 'Typechecked))
forall a. [a] -&gt; a
</span><a href="../../base/src/GHC.List.html#head"><span class="hs-identifier hs-var">head</span></a></span><span> </span><span class="annot"><span class="annottext">[GenLocated SrcSpan (Pat (GhcPass 'Typechecked))]
[XRec (GhcPass 'Typechecked) Pat]
</span><a href="#local-6989586621681142589"><span class="hs-identifier hs-var">lpats</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(Pat (GhcPass 'Typechecked)
 -&gt; GenLocated SrcSpan (Pat (GhcPass 'Typechecked)))
-&gt; Pat (GhcPass 'Typechecked)
-&gt; GenLocated SrcSpan (Pat (GhcPass 'Typechecked))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-765"></span><span>                     </span><span class="annot"><span class="annottext">[XRec (GhcPass 'Typechecked) Pat]
-&gt; Boxity -&gt; Pat (GhcPass 'Typechecked)
</span><a href="GHC.HsToCore.Utils.html#mkVanillaTuplePat"><span class="hs-identifier hs-var">mkVanillaTuplePat</span></a></span><span> </span><span class="annot"><span class="annottext">[XRec (GhcPass 'Typechecked) Pat]
</span><a href="#local-6989586621681142589"><span class="hs-identifier hs-var">lpats</span></a></span><span> </span><span class="annot"><span class="annottext">Boxity
</span><a href="GHC.Types.Basic.html#Boxed"><span class="hs-identifier hs-var">Boxed</span></a></span><span>
</span><span id="line-766"></span><span>
</span><span id="line-767"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkVanillaTuplePat"><span class="hs-identifier hs-type">mkVanillaTuplePat</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#Boxity"><span class="hs-identifier hs-type">Boxity</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#Pat"><span class="hs-identifier hs-type">Pat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span>
</span><span id="line-768"></span><span class="hs-comment">-- A vanilla tuple pattern simply gets its type from its sub-patterns</span><span>
</span><span id="line-769"></span><span id="mkVanillaTuplePat"><span class="annot"><span class="annottext">mkVanillaTuplePat :: [XRec (GhcPass 'Typechecked) Pat]
-&gt; Boxity -&gt; Pat (GhcPass 'Typechecked)
</span><a href="GHC.HsToCore.Utils.html#mkVanillaTuplePat"><span class="hs-identifier hs-var hs-var">mkVanillaTuplePat</span></a></span></span><span> </span><span id="local-6989586621681142587"><span class="annot"><span class="annottext">[XRec (GhcPass 'Typechecked) Pat]
</span><a href="#local-6989586621681142587"><span class="hs-identifier hs-var">pats</span></a></span></span><span> </span><span id="local-6989586621681142586"><span class="annot"><span class="annottext">Boxity
</span><a href="#local-6989586621681142586"><span class="hs-identifier hs-var">box</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">XTuplePat (GhcPass 'Typechecked)
-&gt; [XRec (GhcPass 'Typechecked) Pat]
-&gt; Boxity
-&gt; Pat (GhcPass 'Typechecked)
forall p. XTuplePat p -&gt; [LPat p] -&gt; Boxity -&gt; Pat p
</span><a href="GHC.Hs.Pat.html#TuplePat"><span class="hs-identifier hs-var">TuplePat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(GenLocated SrcSpan (Pat (GhcPass 'Typechecked)) -&gt; Mult)
-&gt; [GenLocated SrcSpan (Pat (GhcPass 'Typechecked))] -&gt; [Mult]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan (Pat (GhcPass 'Typechecked)) -&gt; Mult
XRec (GhcPass 'Typechecked) Pat -&gt; Mult
</span><a href="GHC.Tc.Utils.Zonk.html#hsLPatType"><span class="hs-identifier hs-var">hsLPatType</span></a></span><span> </span><span class="annot"><span class="annottext">[GenLocated SrcSpan (Pat (GhcPass 'Typechecked))]
[XRec (GhcPass 'Typechecked) Pat]
</span><a href="#local-6989586621681142587"><span class="hs-identifier hs-var">pats</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[XRec (GhcPass 'Typechecked) Pat]
</span><a href="#local-6989586621681142587"><span class="hs-identifier hs-var">pats</span></a></span><span> </span><span class="annot"><span class="annottext">Boxity
</span><a href="#local-6989586621681142586"><span class="hs-identifier hs-var">box</span></a></span><span>
</span><span id="line-770"></span><span>
</span><span id="line-771"></span><span class="hs-comment">-- The Big equivalents for the source tuple expressions</span><span>
</span><span id="line-772"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkBigLHsVarTupId"><span class="hs-identifier hs-type">mkBigLHsVarTupId</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span>
</span><span id="line-773"></span><span id="mkBigLHsVarTupId"><span class="annot"><span class="annottext">mkBigLHsVarTupId :: [Id] -&gt; LHsExpr (GhcPass 'Typechecked)
</span><a href="GHC.HsToCore.Utils.html#mkBigLHsVarTupId"><span class="hs-identifier hs-var hs-var">mkBigLHsVarTupId</span></a></span></span><span> </span><span id="local-6989586621681142585"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681142585"><span class="hs-identifier hs-var">ids</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[LHsExpr (GhcPass 'Typechecked)] -&gt; LHsExpr (GhcPass 'Typechecked)
</span><a href="GHC.HsToCore.Utils.html#mkBigLHsTupId"><span class="hs-identifier hs-var">mkBigLHsTupId</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Id -&gt; LHsExpr (GhcPass 'Typechecked))
-&gt; [Id] -&gt; [LHsExpr (GhcPass 'Typechecked)]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Id -&gt; LHsExpr (GhcPass 'Typechecked)
forall (id :: Pass). IdP (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsVar"><span class="hs-identifier hs-var">nlHsVar</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681142585"><span class="hs-identifier hs-var">ids</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-774"></span><span>
</span><span id="line-775"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkBigLHsTupId"><span class="hs-identifier hs-type">mkBigLHsTupId</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span>
</span><span id="line-776"></span><span id="mkBigLHsTupId"><span class="annot"><span class="annottext">mkBigLHsTupId :: [LHsExpr (GhcPass 'Typechecked)] -&gt; LHsExpr (GhcPass 'Typechecked)
</span><a href="GHC.HsToCore.Utils.html#mkBigLHsTupId"><span class="hs-identifier hs-var hs-var">mkBigLHsTupId</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">([LHsExpr (GhcPass 'Typechecked)]
 -&gt; LHsExpr (GhcPass 'Typechecked))
-&gt; [LHsExpr (GhcPass 'Typechecked)]
-&gt; LHsExpr (GhcPass 'Typechecked)
forall a. ([a] -&gt; a) -&gt; [a] -&gt; a
</span><a href="GHC.Hs.Utils.html#mkChunkified"><span class="hs-identifier hs-var">mkChunkified</span></a></span><span> </span><span class="annot"><span class="annottext">[LHsExpr (GhcPass 'Typechecked)] -&gt; LHsExpr (GhcPass 'Typechecked)
forall (a :: Pass). [LHsExpr (GhcPass a)] -&gt; LHsExpr (GhcPass a)
</span><a href="GHC.Hs.Utils.html#mkLHsTupleExpr"><span class="hs-identifier hs-var">mkLHsTupleExpr</span></a></span><span>
</span><span id="line-777"></span><span>
</span><span id="line-778"></span><span class="hs-comment">-- The Big equivalents for the source tuple patterns</span><span>
</span><span id="line-779"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkBigLHsVarPatTupId"><span class="hs-identifier hs-type">mkBigLHsVarPatTupId</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span>
</span><span id="line-780"></span><span id="mkBigLHsVarPatTupId"><span class="annot"><span class="annottext">mkBigLHsVarPatTupId :: [Id] -&gt; XRec (GhcPass 'Typechecked) Pat
</span><a href="GHC.HsToCore.Utils.html#mkBigLHsVarPatTupId"><span class="hs-identifier hs-var hs-var">mkBigLHsVarPatTupId</span></a></span></span><span> </span><span id="local-6989586621681142581"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681142581"><span class="hs-identifier hs-var">bs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[XRec (GhcPass 'Typechecked) Pat]
-&gt; XRec (GhcPass 'Typechecked) Pat
</span><a href="GHC.HsToCore.Utils.html#mkBigLHsPatTupId"><span class="hs-identifier hs-var">mkBigLHsPatTupId</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Id -&gt; GenLocated SrcSpan (Pat (GhcPass 'Typechecked)))
-&gt; [Id] -&gt; [GenLocated SrcSpan (Pat (GhcPass 'Typechecked))]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Id -&gt; GenLocated SrcSpan (Pat (GhcPass 'Typechecked))
forall (id :: Pass). IdP (GhcPass id) -&gt; LPat (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlVarPat"><span class="hs-identifier hs-var">nlVarPat</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681142581"><span class="hs-identifier hs-var">bs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-781"></span><span>
</span><span id="line-782"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkBigLHsPatTupId"><span class="hs-identifier hs-type">mkBigLHsPatTupId</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span>
</span><span id="line-783"></span><span id="mkBigLHsPatTupId"><span class="annot"><span class="annottext">mkBigLHsPatTupId :: [XRec (GhcPass 'Typechecked) Pat]
-&gt; XRec (GhcPass 'Typechecked) Pat
</span><a href="GHC.HsToCore.Utils.html#mkBigLHsPatTupId"><span class="hs-identifier hs-var hs-var">mkBigLHsPatTupId</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">([GenLocated SrcSpan (Pat (GhcPass 'Typechecked))]
 -&gt; GenLocated SrcSpan (Pat (GhcPass 'Typechecked)))
-&gt; [GenLocated SrcSpan (Pat (GhcPass 'Typechecked))]
-&gt; GenLocated SrcSpan (Pat (GhcPass 'Typechecked))
forall a. ([a] -&gt; a) -&gt; [a] -&gt; a
</span><a href="GHC.Hs.Utils.html#mkChunkified"><span class="hs-identifier hs-var">mkChunkified</span></a></span><span> </span><span class="annot"><span class="annottext">[GenLocated SrcSpan (Pat (GhcPass 'Typechecked))]
-&gt; GenLocated SrcSpan (Pat (GhcPass 'Typechecked))
[XRec (GhcPass 'Typechecked) Pat]
-&gt; XRec (GhcPass 'Typechecked) Pat
</span><a href="GHC.HsToCore.Utils.html#mkLHsPatTup"><span class="hs-identifier hs-var">mkLHsPatTup</span></a></span><span>
</span><span id="line-784"></span><span>
</span><span id="line-785"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
        Code for pattern-matching and other failures
*                                                                      *
************************************************************************

Generally, we handle pattern matching failure like this: let-bind a
fail-variable, and use that variable if the thing fails:
\begin{verbatim}
        let fail.33 = error &quot;Help&quot;
        in
        case x of
                p1 -&gt; ...
                p2 -&gt; fail.33
                p3 -&gt; fail.33
                p4 -&gt; ...
\end{verbatim}
Then
\begin{itemize}
\item
If the case can't fail, then there'll be no mention of @fail.33@, and the
simplifier will later discard it.

\item
If it can fail in only one way, then the simplifier will inline it.

\item
Only if it is used more than once will the let-binding remain.
\end{itemize}

There's a problem when the result of the case expression is of
unboxed type.  Then the type of @fail.33@ is unboxed too, and
there is every chance that someone will change the let into a case:
\begin{verbatim}
        case error &quot;Help&quot; of
          fail.33 -&gt; case ....
\end{verbatim}

which is of course utterly wrong.  Rather than drop the condition that
only boxed types can be let-bound, we just turn the fail into a function
for the primitive case:
\begin{verbatim}
        let fail.33 :: Void -&gt; Int#
            fail.33 = \_ -&gt; error &quot;Help&quot;
        in
        case x of
                p1 -&gt; ...
                p2 -&gt; fail.33 void
                p3 -&gt; fail.33 void
                p4 -&gt; ...
\end{verbatim}

Now @fail.33@ is a function, so it can be let-bound.

We would *like* to use join points here; in fact, these &quot;fail variables&quot; are
paradigmatic join points! Sadly, this breaks pattern synonyms, which desugar as
CPS functions - i.e. they take &quot;join points&quot; as parameters. It's not impossible
to imagine extending our type system to allow passing join points around (very
carefully), but we certainly don't support it now.

99.99% of the time, the fail variables wind up as join points in short order
anyway, and the Void# doesn't do much harm.
-}</span><span>
</span><span id="line-849"></span><span>
</span><span id="line-850"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkFailurePair"><span class="hs-identifier hs-type">mkFailurePair</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span>       </span><span class="hs-comment">-- Result type of the whole case expression</span><span>
</span><span id="line-851"></span><span>              </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#CoreBind"><span class="hs-identifier hs-type">CoreBind</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-comment">-- Binds the newly-created fail variable</span><span>
</span><span id="line-852"></span><span>                                </span><span class="hs-comment">-- to \ _ -&gt; expression</span><span>
</span><span id="line-853"></span><span>                      </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- Fail variable applied to realWorld#</span><span>
</span><span id="line-854"></span><span class="hs-comment">-- See Note [Failure thunks and CPR]</span><span>
</span><span id="line-855"></span><span id="mkFailurePair"><span class="annot"><span class="annottext">mkFailurePair :: CoreExpr -&gt; DsM (Bind Id, CoreExpr)
</span><a href="GHC.HsToCore.Utils.html#mkFailurePair"><span class="hs-identifier hs-var hs-var">mkFailurePair</span></a></span></span><span> </span><span id="local-6989586621681142578"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142578"><span class="hs-identifier hs-var">expr</span></a></span></span><span>
</span><span id="line-856"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681142577"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142577"><span class="hs-identifier hs-var">fail_fun_var</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Mult -&gt; Mult -&gt; DsM Id
</span><a href="GHC.HsToCore.Monad.html#newFailLocalDs"><span class="hs-identifier hs-var">newFailLocalDs</span></a></span><span> </span><span class="annot"><span class="annottext">Mult
</span><a href="GHC.Core.Type.html#Many"><span class="hs-identifier hs-var">Many</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Mult
</span><a href="GHC.Builtin.Types.Prim.html#voidPrimTy"><span class="hs-identifier hs-var">voidPrimTy</span></a></span><span> </span><span class="annot"><span class="annottext">Mult -&gt; Mult -&gt; Mult
</span><a href="GHC.Core.TyCo.Rep.html#mkVisFunTyMany"><span class="hs-operator hs-var">`mkVisFunTyMany`</span></a></span><span> </span><span class="annot"><span class="annottext">Mult
</span><a href="#local-6989586621681142573"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-857"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681142572"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142572"><span class="hs-identifier hs-var">fail_fun_arg</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Mult -&gt; Mult -&gt; DsM Id
</span><a href="GHC.HsToCore.Monad.html#newSysLocalDs"><span class="hs-identifier hs-var">newSysLocalDs</span></a></span><span> </span><span class="annot"><span class="annottext">Mult
</span><a href="GHC.Core.Type.html#Many"><span class="hs-identifier hs-var">Many</span></a></span><span> </span><span class="annot"><span class="annottext">Mult
</span><a href="GHC.Builtin.Types.Prim.html#voidPrimTy"><span class="hs-identifier hs-var">voidPrimTy</span></a></span><span>
</span><span id="line-858"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681142571"><span class="annot"><span class="annottext">real_arg :: Id
</span><a href="#local-6989586621681142571"><span class="hs-identifier hs-var hs-var">real_arg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; Id
</span><a href="GHC.Types.Id.html#setOneShotLambda"><span class="hs-identifier hs-var">setOneShotLambda</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142572"><span class="hs-identifier hs-var">fail_fun_arg</span></a></span><span>
</span><span id="line-859"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(Bind Id, CoreExpr) -&gt; DsM (Bind Id, CoreExpr)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; CoreExpr -&gt; Bind Id
forall b. b -&gt; Expr b -&gt; Bind b
</span><a href="GHC.Core.html#NonRec"><span class="hs-identifier hs-var">NonRec</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142577"><span class="hs-identifier hs-var">fail_fun_var</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; CoreExpr -&gt; CoreExpr
forall b. b -&gt; Expr b -&gt; Expr b
</span><a href="GHC.Core.html#Lam"><span class="hs-identifier hs-var">Lam</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142571"><span class="hs-identifier hs-var">real_arg</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142578"><span class="hs-identifier hs-var">expr</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-860"></span><span>                 </span><span class="annot"><span class="annottext">CoreExpr -&gt; CoreExpr -&gt; CoreExpr
forall b. Expr b -&gt; Expr b -&gt; Expr b
</span><a href="GHC.Core.html#App"><span class="hs-identifier hs-var">App</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; CoreExpr
forall b. Id -&gt; Expr b
</span><a href="GHC.Core.html#Var"><span class="hs-identifier hs-var">Var</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142577"><span class="hs-identifier hs-var">fail_fun_var</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; CoreExpr
forall b. Id -&gt; Expr b
</span><a href="GHC.Core.html#Var"><span class="hs-identifier hs-var">Var</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="GHC.Types.Id.Make.html#voidPrimId"><span class="hs-identifier hs-var">voidPrimId</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-861"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-862"></span><span>    </span><span id="local-6989586621681142573"><span class="annot"><span class="annottext">ty :: Mult
</span><a href="#local-6989586621681142573"><span class="hs-identifier hs-var hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoreExpr -&gt; Mult
</span><a href="GHC.Core.Utils.html#exprType"><span class="hs-identifier hs-var">exprType</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142578"><span class="hs-identifier hs-var">expr</span></a></span><span>
</span><span id="line-863"></span><span>
</span><span id="line-864"></span><span class="hs-comment">-- Uses '@mkFailurePair@' to bind the failure case. Infallible matches have</span><span>
</span><span id="line-865"></span><span class="hs-comment">-- neither a failure arg or failure &quot;hole&quot;, so nothing is let-bound, and no</span><span>
</span><span id="line-866"></span><span class="hs-comment">-- extraneous Core is produced.</span><span>
</span><span id="line-867"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#shareFailureHandler"><span class="hs-identifier hs-type">shareFailureHandler</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#MatchResult"><span class="hs-identifier hs-type">MatchResult</span></a></span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#MatchResult"><span class="hs-identifier hs-type">MatchResult</span></a></span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span>
</span><span id="line-868"></span><span id="shareFailureHandler"><span class="annot"><span class="annottext">shareFailureHandler :: MatchResult CoreExpr -&gt; MatchResult CoreExpr
</span><a href="GHC.HsToCore.Utils.html#shareFailureHandler"><span class="hs-identifier hs-var hs-var">shareFailureHandler</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-glyph">\</span><span class="hs-glyph">case</span><span>
</span><span id="line-869"></span><span>  </span><span id="local-6989586621681142568"><span class="annot"><span class="annottext">mr :: MatchResult CoreExpr
</span><a href="#local-6989586621681142568"><span class="hs-identifier hs-var">mr</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.Monad.html#MR_Infallible"><span class="hs-identifier hs-type">MR_Infallible</span></a></span><span> </span><span class="annot"><span class="annottext">DsM CoreExpr
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">MatchResult CoreExpr
</span><a href="#local-6989586621681142568"><span class="hs-identifier hs-var">mr</span></a></span><span>
</span><span id="line-870"></span><span>  </span><span class="annot"><a href="GHC.HsToCore.Monad.html#MR_Fallible"><span class="hs-identifier hs-type">MR_Fallible</span></a></span><span> </span><span id="local-6989586621681142567"><span class="annot"><span class="annottext">CoreExpr -&gt; DsM CoreExpr
</span><a href="#local-6989586621681142567"><span class="hs-identifier hs-var">match_fn</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(CoreExpr -&gt; DsM CoreExpr) -&gt; MatchResult CoreExpr
forall a. (CoreExpr -&gt; DsM a) -&gt; MatchResult a
</span><a href="GHC.HsToCore.Monad.html#MR_Fallible"><span class="hs-identifier hs-var">MR_Fallible</span></a></span><span> </span><span class="annot"><span class="annottext">((CoreExpr -&gt; DsM CoreExpr) -&gt; MatchResult CoreExpr)
-&gt; (CoreExpr -&gt; DsM CoreExpr) -&gt; MatchResult CoreExpr
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681142566"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142566"><span class="hs-identifier hs-var">fail_expr</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-871"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681142565"><span class="annot"><span class="annottext">Bind Id
</span><a href="#local-6989586621681142565"><span class="hs-identifier hs-var">fail_bind</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681142564"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142564"><span class="hs-identifier hs-var">shared_failure_handler</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CoreExpr -&gt; DsM (Bind Id, CoreExpr)
</span><a href="GHC.HsToCore.Utils.html#mkFailurePair"><span class="hs-identifier hs-var">mkFailurePair</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142566"><span class="hs-identifier hs-var">fail_expr</span></a></span><span>
</span><span id="line-872"></span><span>    </span><span id="local-6989586621681142563"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142563"><span class="hs-identifier hs-var">body</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CoreExpr -&gt; DsM CoreExpr
</span><a href="#local-6989586621681142567"><span class="hs-identifier hs-var">match_fn</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142564"><span class="hs-identifier hs-var">shared_failure_handler</span></a></span><span>
</span><span id="line-873"></span><span>    </span><span class="hs-comment">-- Never unboxed, per the above, so always OK for `let` not `case`.</span><span>
</span><span id="line-874"></span><span>    </span><span class="annot"><span class="annottext">CoreExpr -&gt; DsM CoreExpr
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(CoreExpr -&gt; DsM CoreExpr) -&gt; CoreExpr -&gt; DsM CoreExpr
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Bind Id -&gt; CoreExpr -&gt; CoreExpr
forall b. Bind b -&gt; Expr b -&gt; Expr b
</span><a href="GHC.Core.html#Let"><span class="hs-identifier hs-var">Let</span></a></span><span> </span><span class="annot"><span class="annottext">Bind Id
</span><a href="#local-6989586621681142565"><span class="hs-identifier hs-var">fail_bind</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142563"><span class="hs-identifier hs-var">body</span></a></span><span>
</span><span id="line-875"></span><span>
</span><span id="line-876"></span><span class="hs-comment">{-
Note [Failure thunks and CPR]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(This note predates join points as formal entities (hence the quotation marks).
We can't use actual join points here (see above); if we did, this would also
solve the CPR problem, since join points don't get CPR'd. See Note [Don't CPR
join points] in GHC.Core.Opt.WorkWrap.)

When we make a failure point we ensure that it
does not look like a thunk. Example:

   let fail = \rw -&gt; error &quot;urk&quot;
   in case x of
        [] -&gt; fail realWorld#
        (y:ys) -&gt; case ys of
                    [] -&gt; fail realWorld#
                    (z:zs) -&gt; (y,z)

Reason: we know that a failure point is always a &quot;join point&quot; and is
entered at most once.  Adding a dummy 'realWorld' token argument makes
it clear that sharing is not an issue.  And that in turn makes it more
CPR-friendly.  This matters a lot: if you don't get it right, you lose
the tail call property.  For example, see #3403.


************************************************************************
*                                                                      *
              Ticks
*                                                                      *
********************************************************************* -}</span><span>
</span><span id="line-906"></span><span>
</span><span id="line-907"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkOptTickBox"><span class="hs-identifier hs-type">mkOptTickBox</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.html#Tickish"><span class="hs-identifier hs-type">Tickish</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span>
</span><span id="line-908"></span><span id="mkOptTickBox"><span class="annot"><span class="annottext">mkOptTickBox :: [Tickish Id] -&gt; CoreExpr -&gt; CoreExpr
</span><a href="GHC.HsToCore.Utils.html#mkOptTickBox"><span class="hs-identifier hs-var hs-var">mkOptTickBox</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(CoreExpr -&gt; [Tickish Id] -&gt; CoreExpr)
-&gt; [Tickish Id] -&gt; CoreExpr -&gt; CoreExpr
forall a b c. (a -&gt; b -&gt; c) -&gt; b -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#flip"><span class="hs-identifier hs-var">flip</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Tickish Id -&gt; CoreExpr -&gt; CoreExpr)
-&gt; CoreExpr -&gt; [Tickish Id] -&gt; CoreExpr
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="annot"><span class="annottext">Tickish Id -&gt; CoreExpr -&gt; CoreExpr
forall b. Tickish Id -&gt; Expr b -&gt; Expr b
</span><a href="GHC.Core.html#Tick"><span class="hs-identifier hs-var">Tick</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-909"></span><span>
</span><span id="line-910"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#mkBinaryTickBox"><span class="hs-identifier hs-type">mkBinaryTickBox</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span>
</span><span id="line-911"></span><span id="mkBinaryTickBox"><span class="annot"><span class="annottext">mkBinaryTickBox :: ConTag -&gt; ConTag -&gt; CoreExpr -&gt; DsM CoreExpr
</span><a href="GHC.HsToCore.Utils.html#mkBinaryTickBox"><span class="hs-identifier hs-var hs-var">mkBinaryTickBox</span></a></span></span><span> </span><span id="local-6989586621681142560"><span class="annot"><span class="annottext">ConTag
</span><a href="#local-6989586621681142560"><span class="hs-identifier hs-var">ixT</span></a></span></span><span> </span><span id="local-6989586621681142559"><span class="annot"><span class="annottext">ConTag
</span><a href="#local-6989586621681142559"><span class="hs-identifier hs-var">ixF</span></a></span></span><span> </span><span id="local-6989586621681142558"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142558"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-912"></span><span>       </span><span id="local-6989586621681142557"><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681142557"><span class="hs-identifier hs-var">uq</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRnIf DsGblEnv DsLclEnv Unique
forall gbl lcl. TcRnIf gbl lcl Unique
</span><a href="GHC.Tc.Utils.Monad.html#newUnique"><span class="hs-identifier hs-var">newUnique</span></a></span><span>
</span><span id="line-913"></span><span>       </span><span id="local-6989586621681142555"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681142555"><span class="hs-identifier hs-var">this_mod</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IOEnv (Env DsGblEnv DsLclEnv) Module
forall (m :: * -&gt; *). HasModule m =&gt; m Module
</span><a href="GHC.Unit.Module.html#getModule"><span class="hs-identifier hs-var">getModule</span></a></span><span>
</span><span id="line-914"></span><span>       </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681142553"><span class="annot"><span class="annottext">bndr1 :: Id
</span><a href="#local-6989586621681142553"><span class="hs-identifier hs-var hs-var">bndr1</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FastString -&gt; Unique -&gt; Mult -&gt; Mult -&gt; Id
</span><a href="GHC.Types.Id.html#mkSysLocal"><span class="hs-identifier hs-var">mkSysLocal</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; FastString
</span><a href="GHC.Data.FastString.html#fsLit"><span class="hs-identifier hs-var">fsLit</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;t1&quot;</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681142557"><span class="hs-identifier hs-var">uq</span></a></span><span> </span><span class="annot"><span class="annottext">Mult
</span><a href="GHC.Core.Type.html#One"><span class="hs-identifier hs-var">One</span></a></span><span> </span><span class="annot"><span class="annottext">Mult
</span><a href="GHC.Builtin.Types.html#boolTy"><span class="hs-identifier hs-var">boolTy</span></a></span><span>
</span><span id="line-915"></span><span>         </span><span class="hs-comment">-- It's always sufficient to pattern-match on a boolean with</span><span>
</span><span id="line-916"></span><span>         </span><span class="hs-comment">-- multiplicity 'One'.</span><span>
</span><span id="line-917"></span><span>       </span><span class="hs-keyword">let</span><span>
</span><span id="line-918"></span><span>           </span><span id="local-6989586621681142548"><span class="annot"><span class="annottext">falseBox :: CoreExpr
</span><a href="#local-6989586621681142548"><span class="hs-identifier hs-var hs-var">falseBox</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Tickish Id -&gt; CoreExpr -&gt; CoreExpr
forall b. Tickish Id -&gt; Expr b -&gt; Expr b
</span><a href="GHC.Core.html#Tick"><span class="hs-identifier hs-var">Tick</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Module -&gt; ConTag -&gt; Tickish Id
forall id. Module -&gt; ConTag -&gt; Tickish id
</span><a href="GHC.Core.html#HpcTick"><span class="hs-identifier hs-var">HpcTick</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681142555"><span class="hs-identifier hs-var">this_mod</span></a></span><span> </span><span class="annot"><span class="annottext">ConTag
</span><a href="#local-6989586621681142559"><span class="hs-identifier hs-var">ixF</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; CoreExpr
forall b. Id -&gt; Expr b
</span><a href="GHC.Core.html#Var"><span class="hs-identifier hs-var">Var</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="GHC.Builtin.Types.html#falseDataConId"><span class="hs-identifier hs-var">falseDataConId</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-919"></span><span>           </span><span id="local-6989586621681142545"><span class="annot"><span class="annottext">trueBox :: CoreExpr
</span><a href="#local-6989586621681142545"><span class="hs-identifier hs-var hs-var">trueBox</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Tickish Id -&gt; CoreExpr -&gt; CoreExpr
forall b. Tickish Id -&gt; Expr b -&gt; Expr b
</span><a href="GHC.Core.html#Tick"><span class="hs-identifier hs-var">Tick</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Module -&gt; ConTag -&gt; Tickish Id
forall id. Module -&gt; ConTag -&gt; Tickish id
</span><a href="GHC.Core.html#HpcTick"><span class="hs-identifier hs-var">HpcTick</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681142555"><span class="hs-identifier hs-var">this_mod</span></a></span><span> </span><span class="annot"><span class="annottext">ConTag
</span><a href="#local-6989586621681142560"><span class="hs-identifier hs-var">ixT</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; CoreExpr
forall b. Id -&gt; Expr b
</span><a href="GHC.Core.html#Var"><span class="hs-identifier hs-var">Var</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="GHC.Builtin.Types.html#trueDataConId"><span class="hs-identifier hs-var">trueDataConId</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-920"></span><span>       </span><span class="hs-comment">--</span><span>
</span><span id="line-921"></span><span>       </span><span class="annot"><span class="annottext">CoreExpr -&gt; DsM CoreExpr
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(CoreExpr -&gt; DsM CoreExpr) -&gt; CoreExpr -&gt; DsM CoreExpr
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr -&gt; Id -&gt; Mult -&gt; [Alt Id] -&gt; CoreExpr
forall b. Expr b -&gt; b -&gt; Mult -&gt; [Alt b] -&gt; Expr b
</span><a href="GHC.Core.html#Case"><span class="hs-identifier hs-var">Case</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142558"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681142553"><span class="hs-identifier hs-var">bndr1</span></a></span><span> </span><span class="annot"><span class="annottext">Mult
</span><a href="GHC.Builtin.Types.html#boolTy"><span class="hs-identifier hs-var">boolTy</span></a></span><span>
</span><span id="line-922"></span><span>                       </span><span class="hs-special">[</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DataCon -&gt; AltCon
</span><a href="GHC.Core.html#DataAlt"><span class="hs-identifier hs-var">DataAlt</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="GHC.Builtin.Types.html#falseDataCon"><span class="hs-identifier hs-var">falseDataCon</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142548"><span class="hs-identifier hs-var">falseBox</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-923"></span><span>                       </span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DataCon -&gt; AltCon
</span><a href="GHC.Core.html#DataAlt"><span class="hs-identifier hs-var">DataAlt</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="GHC.Builtin.Types.html#trueDataCon"><span class="hs-identifier hs-var">trueDataCon</span></a></span><span class="hs-special">,</span><span>  </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142545"><span class="hs-identifier hs-var">trueBox</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-924"></span><span>                       </span><span class="hs-special">]</span><span>
</span><span id="line-925"></span><span>
</span><span id="line-926"></span><span>
</span><span id="line-927"></span><span>
</span><span id="line-928"></span><span class="hs-comment">-- *******************************************************************</span><span>
</span><span id="line-929"></span><span>
</span><span id="line-930"></span><span class="hs-comment">{- Note [decideBangHood]
~~~~~~~~~~~~~~~~~~~~~~~~
With -XStrict we may make /outermost/ patterns more strict.
E.g.
       let (Just x) = e in ...
          ==&gt;
       let !(Just x) = e in ...
and
       f x = e
          ==&gt;
       f !x = e

This adjustment is done by decideBangHood,

  * Just before constructing an EqnInfo, in GHC.HsToCore.Match
      (matchWrapper and matchSinglePat)

  * When desugaring a pattern-binding in GHC.HsToCore.Binds.dsHsBind

Note that it is /not/ done recursively.  See the -XStrict
spec in the user manual.

Specifically:
   ~pat    =&gt; pat    -- when -XStrict (even if pat = ~pat')
   !pat    =&gt; !pat   -- always
   pat     =&gt; !pat   -- when -XStrict
   pat     =&gt; pat    -- otherwise
-}</span><span>
</span><span id="line-958"></span><span>
</span><span id="line-959"></span><span>
</span><span id="line-960"></span><span class="hs-comment">-- | Use -XStrict to add a ! or remove a ~</span><span>
</span><span id="line-961"></span><span class="hs-comment">-- See Note [decideBangHood]</span><span>
</span><span id="line-962"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#decideBangHood"><span class="hs-identifier hs-type">decideBangHood</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span>
</span><span id="line-963"></span><span>               </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span>  </span><span class="hs-comment">-- ^ Original pattern</span><span>
</span><span id="line-964"></span><span>               </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span>  </span><span class="hs-comment">-- Pattern with bang if necessary</span><span>
</span><span id="line-965"></span><span id="decideBangHood"><span class="annot"><span class="annottext">decideBangHood :: DynFlags
-&gt; XRec (GhcPass 'Typechecked) Pat
-&gt; XRec (GhcPass 'Typechecked) Pat
</span><a href="GHC.HsToCore.Utils.html#decideBangHood"><span class="hs-identifier hs-var hs-var">decideBangHood</span></a></span></span><span> </span><span id="local-6989586621681142541"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681142541"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681142540"><span class="annot"><span class="annottext">XRec (GhcPass 'Typechecked) Pat
</span><a href="#local-6989586621681142540"><span class="hs-identifier hs-var">lpat</span></a></span></span><span>
</span><span id="line-966"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Extension -&gt; DynFlags -&gt; Bool
</span><a href="GHC.Driver.Session.html#xopt"><span class="hs-identifier hs-var">xopt</span></a></span><span> </span><span class="annot"><span class="annottext">Extension
</span><a href="../../ghc-boot-th/src/GHC.LanguageExtensions.Type.html#Strict"><span class="hs-identifier hs-var">LangExt.Strict</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681142541"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-967"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">XRec (GhcPass 'Typechecked) Pat
</span><a href="#local-6989586621681142540"><span class="hs-identifier hs-var">lpat</span></a></span><span>
</span><span id="line-968"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>   </span><span class="hs-comment">--  -XStrict</span><span>
</span><span id="line-969"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan (Pat (GhcPass 'Typechecked))
-&gt; GenLocated SrcSpan (Pat (GhcPass 'Typechecked))
forall {p} {l}.
(XRec p Pat ~ GenLocated l (Pat p), XBangPat p ~ NoExtField) =&gt;
GenLocated l (Pat p) -&gt; GenLocated l (Pat p)
</span><a href="#local-6989586621681142537"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan (Pat (GhcPass 'Typechecked))
XRec (GhcPass 'Typechecked) Pat
</span><a href="#local-6989586621681142540"><span class="hs-identifier hs-var">lpat</span></a></span><span>
</span><span id="line-970"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-971"></span><span>    </span><span id="local-6989586621681142537"><span class="annot"><span class="annottext">go :: GenLocated l (Pat p) -&gt; GenLocated l (Pat p)
</span><a href="#local-6989586621681142537"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621681142528"><span class="annot"><span class="annottext">lp :: GenLocated l (Pat p)
</span><a href="#local-6989586621681142528"><span class="hs-identifier hs-var">lp</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681142527"><span class="annot"><span class="annottext">l
</span><a href="#local-6989586621681142527"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621681142526"><span class="annot"><span class="annottext">Pat p
</span><a href="#local-6989586621681142526"><span class="hs-identifier hs-var">p</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-972"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Pat p
</span><a href="#local-6989586621681142526"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-973"></span><span>           </span><span class="annot"><a href="GHC.Hs.Pat.html#ParPat"><span class="hs-identifier hs-type">ParPat</span></a></span><span> </span><span id="local-6989586621681142525"><span class="annot"><span class="annottext">XParPat p
</span><a href="#local-6989586621681142525"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621681142524"><span class="annot"><span class="annottext">XRec p Pat
</span><a href="#local-6989586621681142524"><span class="hs-identifier hs-var">p</span></a></span></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">l -&gt; Pat p -&gt; GenLocated l (Pat p)
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">l
</span><a href="#local-6989586621681142527"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">XParPat p -&gt; XRec p Pat -&gt; Pat p
forall p. XParPat p -&gt; LPat p -&gt; Pat p
</span><a href="GHC.Hs.Pat.html#ParPat"><span class="hs-identifier hs-var">ParPat</span></a></span><span> </span><span class="annot"><span class="annottext">XParPat p
</span><a href="#local-6989586621681142525"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenLocated l (Pat p) -&gt; GenLocated l (Pat p)
</span><a href="#local-6989586621681142537"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">GenLocated l (Pat p)
XRec p Pat
</span><a href="#local-6989586621681142524"><span class="hs-identifier hs-var">p</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-974"></span><span>           </span><span class="annot"><a href="GHC.Hs.Pat.html#LazyPat"><span class="hs-identifier hs-type">LazyPat</span></a></span><span> </span><span class="annot"><span class="annottext">XLazyPat p
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681142523"><span class="annot"><span class="annottext">XRec p Pat
</span><a href="#local-6989586621681142523"><span class="hs-identifier hs-var">lp'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">GenLocated l (Pat p)
XRec p Pat
</span><a href="#local-6989586621681142523"><span class="hs-identifier hs-var">lp'</span></a></span><span>
</span><span id="line-975"></span><span>           </span><span class="annot"><a href="GHC.Hs.Pat.html#BangPat"><span class="hs-identifier hs-type">BangPat</span></a></span><span> </span><span class="annot"><span class="annottext">XBangPat p
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">XRec p Pat
</span><span class="hs-identifier">_</span></span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">GenLocated l (Pat p)
</span><a href="#local-6989586621681142528"><span class="hs-identifier hs-var">lp</span></a></span><span>
</span><span id="line-976"></span><span>           </span><span class="annot"><span class="annottext">Pat p
</span><span class="hs-identifier">_</span></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">l -&gt; Pat p -&gt; GenLocated l (Pat p)
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">l
</span><a href="#local-6989586621681142527"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">XBangPat p -&gt; XRec p Pat -&gt; Pat p
forall p. XBangPat p -&gt; LPat p -&gt; Pat p
</span><a href="GHC.Hs.Pat.html#BangPat"><span class="hs-identifier hs-var">BangPat</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XBangPat p
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span> </span><span class="annot"><span class="annottext">GenLocated l (Pat p)
XRec p Pat
</span><a href="#local-6989586621681142528"><span class="hs-identifier hs-var">lp</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-977"></span><span>
</span><span id="line-978"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#isTrueLHsExpr"><span class="hs-identifier hs-type">isTrueLHsExpr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-979"></span><span>
</span><span id="line-980"></span><span class="hs-comment">-- Returns Just {..} if we're sure that the expression is True</span><span>
</span><span id="line-981"></span><span class="hs-comment">-- I.e.   * 'True' datacon</span><span>
</span><span id="line-982"></span><span class="hs-comment">--        * 'otherwise' Id</span><span>
</span><span id="line-983"></span><span class="hs-comment">--        * Trivial wappings of these</span><span>
</span><span id="line-984"></span><span class="hs-comment">-- The arguments to Just are any HsTicks that we have found,</span><span>
</span><span id="line-985"></span><span class="hs-comment">-- because we still want to tick then, even it they are always evaluated.</span><span>
</span><span id="line-986"></span><span id="isTrueLHsExpr"><span class="annot"><span class="annottext">isTrueLHsExpr :: LHsExpr (GhcPass 'Typechecked) -&gt; Maybe (CoreExpr -&gt; DsM CoreExpr)
</span><a href="GHC.HsToCore.Utils.html#isTrueLHsExpr"><span class="hs-identifier hs-var hs-var">isTrueLHsExpr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Expr.html#HsVar"><span class="hs-identifier hs-type">HsVar</span></a></span><span> </span><span class="annot"><span class="annottext">XVar (GhcPass 'Typechecked)
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681142520"><span class="annot"><span class="annottext">IdP (GhcPass 'Typechecked)
</span><a href="#local-6989586621681142520"><span class="hs-identifier hs-var">v</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-987"></span><span>  </span><span class="hs-glyph">|</span><span>  </span><span class="annot"><span class="annottext">Id
IdP (GhcPass 'Typechecked)
</span><a href="#local-6989586621681142520"><span class="hs-identifier hs-var">v</span></a></span><span> </span><span class="annot"><span class="annottext">Id -&gt; Unique -&gt; Bool
forall a. Uniquable a =&gt; a -&gt; Unique -&gt; Bool
</span><a href="GHC.Types.Unique.html#hasKey"><span class="hs-operator hs-var">`hasKey`</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#otherwiseIdKey"><span class="hs-identifier hs-var">otherwiseIdKey</span></a></span><span>
</span><span id="line-988"></span><span>     </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Id
IdP (GhcPass 'Typechecked)
</span><a href="#local-6989586621681142520"><span class="hs-identifier hs-var">v</span></a></span><span> </span><span class="annot"><span class="annottext">Id -&gt; Unique -&gt; Bool
forall a. Uniquable a =&gt; a -&gt; Unique -&gt; Bool
</span><a href="GHC.Types.Unique.html#hasKey"><span class="hs-operator hs-var">`hasKey`</span></a></span><span> </span><span class="annot"><span class="annottext">Id -&gt; Unique
forall a. Uniquable a =&gt; a -&gt; Unique
</span><a href="GHC.Types.Unique.html#getUnique"><span class="hs-identifier hs-var">getUnique</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="GHC.Builtin.Types.html#trueDataConId"><span class="hs-identifier hs-var">trueDataConId</span></a></span><span>
</span><span id="line-989"></span><span>                                              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(CoreExpr -&gt; DsM CoreExpr) -&gt; Maybe (CoreExpr -&gt; DsM CoreExpr)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr -&gt; DsM CoreExpr
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span>
</span><span id="line-990"></span><span>        </span><span class="hs-comment">-- trueDataConId doesn't have the same unique as trueDataCon</span><span>
</span><span id="line-991"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#isTrueLHsExpr"><span class="hs-identifier hs-var">isTrueLHsExpr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Expr.html#HsConLikeOut"><span class="hs-identifier hs-type">HsConLikeOut</span></a></span><span> </span><span class="annot"><span class="annottext">XConLikeOut (GhcPass 'Typechecked)
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681142515"><span class="annot"><span class="annottext">ConLike
</span><a href="#local-6989586621681142515"><span class="hs-identifier hs-var">con</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-992"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">ConLike
</span><a href="#local-6989586621681142515"><span class="hs-identifier hs-var">con</span></a></span><span> </span><span class="annot"><span class="annottext">ConLike -&gt; Unique -&gt; Bool
forall a. Uniquable a =&gt; a -&gt; Unique -&gt; Bool
</span><a href="GHC.Types.Unique.html#hasKey"><span class="hs-operator hs-var">`hasKey`</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; Unique
forall a. Uniquable a =&gt; a -&gt; Unique
</span><a href="GHC.Types.Unique.html#getUnique"><span class="hs-identifier hs-var">getUnique</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="GHC.Builtin.Types.html#trueDataCon"><span class="hs-identifier hs-var">trueDataCon</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(CoreExpr -&gt; DsM CoreExpr) -&gt; Maybe (CoreExpr -&gt; DsM CoreExpr)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr -&gt; DsM CoreExpr
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span>
</span><span id="line-993"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#isTrueLHsExpr"><span class="hs-identifier hs-var">isTrueLHsExpr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Expr.html#HsTick"><span class="hs-identifier hs-type">HsTick</span></a></span><span> </span><span class="annot"><span class="annottext">XTick (GhcPass 'Typechecked)
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681142513"><span class="annot"><span class="annottext">Tickish (IdP (GhcPass 'Typechecked))
</span><a href="#local-6989586621681142513"><span class="hs-identifier hs-var">tickish</span></a></span></span><span> </span><span id="local-6989586621681142512"><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681142512"><span class="hs-identifier hs-var">e</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-994"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681142511"><span class="annot"><span class="annottext">CoreExpr -&gt; DsM CoreExpr
</span><a href="#local-6989586621681142511"><span class="hs-identifier hs-var">ticks</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked) -&gt; Maybe (CoreExpr -&gt; DsM CoreExpr)
</span><a href="GHC.HsToCore.Utils.html#isTrueLHsExpr"><span class="hs-identifier hs-var">isTrueLHsExpr</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681142512"><span class="hs-identifier hs-var">e</span></a></span><span>
</span><span id="line-995"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(CoreExpr -&gt; DsM CoreExpr) -&gt; Maybe (CoreExpr -&gt; DsM CoreExpr)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621681142510"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142510"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621681142509"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142509"><span class="hs-identifier hs-var">wrapped</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CoreExpr -&gt; DsM CoreExpr
</span><a href="#local-6989586621681142511"><span class="hs-identifier hs-var">ticks</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142510"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-996"></span><span>                     </span><span class="annot"><span class="annottext">CoreExpr -&gt; DsM CoreExpr
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Tickish Id -&gt; CoreExpr -&gt; CoreExpr
forall b. Tickish Id -&gt; Expr b -&gt; Expr b
</span><a href="GHC.Core.html#Tick"><span class="hs-identifier hs-var">Tick</span></a></span><span> </span><span class="annot"><span class="annottext">Tickish Id
Tickish (IdP (GhcPass 'Typechecked))
</span><a href="#local-6989586621681142513"><span class="hs-identifier hs-var">tickish</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142509"><span class="hs-identifier hs-var">wrapped</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-997"></span><span>   </span><span class="hs-comment">-- This encodes that the result is constant True for Hpc tick purposes;</span><span>
</span><span id="line-998"></span><span>   </span><span class="hs-comment">-- which is specifically what isTrueLHsExpr is trying to find out.</span><span>
</span><span id="line-999"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#isTrueLHsExpr"><span class="hs-identifier hs-var">isTrueLHsExpr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Expr.html#HsBinTick"><span class="hs-identifier hs-type">HsBinTick</span></a></span><span> </span><span class="annot"><span class="annottext">XBinTick (GhcPass 'Typechecked)
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681142507"><span class="annot"><span class="annottext">ConTag
</span><a href="#local-6989586621681142507"><span class="hs-identifier hs-var">ixT</span></a></span></span><span> </span><span class="annot"><span class="annottext">ConTag
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681142506"><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681142506"><span class="hs-identifier hs-var">e</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1000"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681142505"><span class="annot"><span class="annottext">CoreExpr -&gt; DsM CoreExpr
</span><a href="#local-6989586621681142505"><span class="hs-identifier hs-var">ticks</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked) -&gt; Maybe (CoreExpr -&gt; DsM CoreExpr)
</span><a href="GHC.HsToCore.Utils.html#isTrueLHsExpr"><span class="hs-identifier hs-var">isTrueLHsExpr</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681142506"><span class="hs-identifier hs-var">e</span></a></span><span>
</span><span id="line-1001"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(CoreExpr -&gt; DsM CoreExpr) -&gt; Maybe (CoreExpr -&gt; DsM CoreExpr)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621681142504"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142504"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621681142503"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142503"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CoreExpr -&gt; DsM CoreExpr
</span><a href="#local-6989586621681142505"><span class="hs-identifier hs-var">ticks</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142504"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-1002"></span><span>                     </span><span id="local-6989586621681142502"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681142502"><span class="hs-identifier hs-var">this_mod</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IOEnv (Env DsGblEnv DsLclEnv) Module
forall (m :: * -&gt; *). HasModule m =&gt; m Module
</span><a href="GHC.Unit.Module.html#getModule"><span class="hs-identifier hs-var">getModule</span></a></span><span>
</span><span id="line-1003"></span><span>                     </span><span class="annot"><span class="annottext">CoreExpr -&gt; DsM CoreExpr
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Tickish Id -&gt; CoreExpr -&gt; CoreExpr
forall b. Tickish Id -&gt; Expr b -&gt; Expr b
</span><a href="GHC.Core.html#Tick"><span class="hs-identifier hs-var">Tick</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Module -&gt; ConTag -&gt; Tickish Id
forall id. Module -&gt; ConTag -&gt; Tickish id
</span><a href="GHC.Core.html#HpcTick"><span class="hs-identifier hs-var">HpcTick</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681142502"><span class="hs-identifier hs-var">this_mod</span></a></span><span> </span><span class="annot"><span class="annottext">ConTag
</span><a href="#local-6989586621681142507"><span class="hs-identifier hs-var">ixT</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681142503"><span class="hs-identifier hs-var">e</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1004"></span><span>
</span><span id="line-1005"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#isTrueLHsExpr"><span class="hs-identifier hs-var">isTrueLHsExpr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Expr.html#HsPar"><span class="hs-identifier hs-type">HsPar</span></a></span><span> </span><span class="annot"><span class="annottext">XPar (GhcPass 'Typechecked)
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681142500"><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681142500"><span class="hs-identifier hs-var">e</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked) -&gt; Maybe (CoreExpr -&gt; DsM CoreExpr)
</span><a href="GHC.HsToCore.Utils.html#isTrueLHsExpr"><span class="hs-identifier hs-var">isTrueLHsExpr</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681142500"><span class="hs-identifier hs-var">e</span></a></span><span>
</span><span id="line-1006"></span><span class="annot"><a href="GHC.HsToCore.Utils.html#isTrueLHsExpr"><span class="hs-identifier hs-var">isTrueLHsExpr</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><span class="hs-identifier">_</span></span><span>                   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (CoreExpr -&gt; DsM CoreExpr)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1007"></span></pre></body></html>